Skip to content

Commit

Permalink
lazyInject sync all parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Mar 6, 2022
1 parent 6900f1c commit 2766f17
Show file tree
Hide file tree
Showing 93 changed files with 83,939 additions and 36,313 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-atomic-organism",
"version": "0.11.8",
"version": "0.12.0",
"description": "Atomic design in React (organisms)",
"main": "./build/cjs/src/index.js",
"module": "./build/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/organism-react-animate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "organism-react-animate",
"version": "0.8.5",
"version": "0.9.0",
"description": "React Animate",
"repository": "react-atomic/react-atomic-organism",
"main": "./build/cjs/src/index.js",
Expand Down
11 changes: 6 additions & 5 deletions packages/organism-react-animate/ui/organisms/AnimateGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect, useMemo, useRef } from "react";
import {
build,
mixClass,
lazyInject,
useLazyInject,
getChildMapping,
} from "react-atomic-molecule";
import get from "get-object-value";
Expand Down Expand Up @@ -76,9 +76,10 @@ const AnimateGroup = (props) => {
const mount = useRef(false);
const aniProps = getAniProps(otherProps, true);
keys(aniProps).forEach((key) => delete otherProps[key]);
useEffect(() => {
injects = lazyInject(injects, InjectStyles({ statusKey }));
}, []);
injects[statusKey] = useLazyInject(
InjectStyles({ statusKey }),
injects[statusKey]
);
useEffect(() => {
let _exitTimeout;
let _enterTimeout;
Expand Down Expand Up @@ -153,7 +154,7 @@ AnimateGroup.defaultProps = {

export default AnimateGroup;

let injects;
const injects = {};
const InjectStyles = ({ statusKey }) => ({
init: [
{
Expand Down
19 changes: 14 additions & 5 deletions packages/organism-react-dropzone/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"name": "organism-react-dropzone",
"version": "0.1.3",
"version": "0.2.0",
"description": "React dropzone",
"repository": "react-atomic/react-atomic-organism",
"main": "./build/cjs/src/index.js",
"module": "./build/es/src/index.js",
"keywords": ["react", "react-component", "organism", "atomic-ui"],
"keywords": [
"react",
"react-component",
"organism",
"atomic-ui"
],
"author": "Hill <[email protected]>",
"license": "MIT",
"dependencies": {
Expand All @@ -27,17 +32,21 @@
},
"scripts": {
"clean": "find ./build -name '*.*' | xargs rm -rf",
"build:cjs": "npm run build:cjs:src && npm run build:cjs:ui",
"build:cjs:src": "BABEL_ENV=cjs babel src -d build/cjs/src --root-mode upward",
"build:cjs:ui": "BABEL_ENV=cjs babel ui -d build/cjs/ui --root-mode upward",
"build:es": "npm run build:es:src && npm run build:es:ui",
"build:cjs": "npm run build:cjs:src && npm run build:cjs:ui",
"build:es:src": "BABEL_ENV=es babel src -d build/es/src --root-mode upward",
"build:es:ui": "BABEL_ENV=es babel ui -d build/es/ui --root-mode upward",
"build:es": "npm run build:es:src && npm run build:es:ui",
"build": "npm run clean && npm run build:cjs && npm run build:es",
"mochaFor": "mocha -r jsdom-global/register",
"mocha": "npm run mochaFor -- 'build/cjs/**/__tests__/*.js'",
"test": "npm run build && npm run mocha",
"prepublishOnly": "npm run test"
},
"files": ["build", "package.json", "README.md"]
"files": [
"build",
"package.json",
"README.md"
]
}
2 changes: 1 addition & 1 deletion packages/organism-react-dropzone/ui/organisms/Dropzone.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Dropzone extends Component {
* Sets up dropzone.js with the component.
*/
componentDidMount() {
injects = lazyInject(injects, InjectStyles);
injects = lazyInject(InjectStyles, injects);
import("../../src/dropzone").then((dropzone) => {
dropzone = getDefault(dropzone);
dropzone.autoDiscover = false;
Expand Down
Loading

0 comments on commit 2766f17

Please sign in to comment.