floppy-disk 3.7.3 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/react.mjs +4 -4
- package/package.json +1 -1
- package/react.js +4 -4
package/esm/react.mjs
CHANGED
|
@@ -52,7 +52,7 @@ const useStoreStateProxy = (storeState) => {
|
|
|
52
52
|
const NO_INITIAL_VALUE = {};
|
|
53
53
|
const useStoreStateWithInitializer = (store, initialState = NO_INITIAL_VALUE) => {
|
|
54
54
|
const initiatedAt = useRef(new WeakMap([[store, 0]]));
|
|
55
|
-
|
|
55
|
+
useEffect(() => {
|
|
56
56
|
if (initialState === NO_INITIAL_VALUE || initiatedAt.current.get(store)) return;
|
|
57
57
|
store.setState(initialState);
|
|
58
58
|
initiatedAt.current.set(store, Date.now());
|
|
@@ -65,7 +65,7 @@ const useStoreState = (store, options = {}) => {
|
|
|
65
65
|
const [state] = useStoreStateWithInitializer(store, options.initialState);
|
|
66
66
|
const [trackedState, usedPathsRef] = useStoreStateProxy(state);
|
|
67
67
|
const [, reRender] = useState({});
|
|
68
|
-
|
|
68
|
+
useEffect(() => {
|
|
69
69
|
return store.subscribe((nextState, prevState, changedKeys) => {
|
|
70
70
|
const paths = compressPaths(usedPathsRef.current);
|
|
71
71
|
for (const path of paths) {
|
|
@@ -445,7 +445,7 @@ const createQuery = (queryFn, options = {}) => {
|
|
|
445
445
|
) : storeStateToBeUsed
|
|
446
446
|
);
|
|
447
447
|
const [, reRender] = useState({});
|
|
448
|
-
|
|
448
|
+
useEffect(() => {
|
|
449
449
|
return store.subscribe((nextState, prevState2, changedKeys) => {
|
|
450
450
|
if (prevState2.state === "INITIAL" && !prevState2.isPending && nextState.isPending && !nextState.isRetrying) {
|
|
451
451
|
return;
|
|
@@ -460,7 +460,7 @@ const createQuery = (queryFn, options = {}) => {
|
|
|
460
460
|
}
|
|
461
461
|
});
|
|
462
462
|
}, [store]);
|
|
463
|
-
|
|
463
|
+
useEffect(() => {
|
|
464
464
|
if (revalidateOnMount !== false) {
|
|
465
465
|
if (!initialDataIsStale) {
|
|
466
466
|
const dataInitiatedAt = initialDataInitiatedAt.current.get(store);
|
package/package.json
CHANGED
package/react.js
CHANGED
|
@@ -54,7 +54,7 @@ const useStoreStateProxy = (storeState) => {
|
|
|
54
54
|
const NO_INITIAL_VALUE = {};
|
|
55
55
|
const useStoreStateWithInitializer = (store, initialState = NO_INITIAL_VALUE) => {
|
|
56
56
|
const initiatedAt = react.useRef(new WeakMap([[store, 0]]));
|
|
57
|
-
|
|
57
|
+
react.useEffect(() => {
|
|
58
58
|
if (initialState === NO_INITIAL_VALUE || initiatedAt.current.get(store)) return;
|
|
59
59
|
store.setState(initialState);
|
|
60
60
|
initiatedAt.current.set(store, Date.now());
|
|
@@ -67,7 +67,7 @@ const useStoreState = (store, options = {}) => {
|
|
|
67
67
|
const [state] = useStoreStateWithInitializer(store, options.initialState);
|
|
68
68
|
const [trackedState, usedPathsRef] = useStoreStateProxy(state);
|
|
69
69
|
const [, reRender] = react.useState({});
|
|
70
|
-
|
|
70
|
+
react.useEffect(() => {
|
|
71
71
|
return store.subscribe((nextState, prevState, changedKeys) => {
|
|
72
72
|
const paths = compressPaths(usedPathsRef.current);
|
|
73
73
|
for (const path of paths) {
|
|
@@ -447,7 +447,7 @@ const createQuery = (queryFn, options = {}) => {
|
|
|
447
447
|
) : storeStateToBeUsed
|
|
448
448
|
);
|
|
449
449
|
const [, reRender] = react.useState({});
|
|
450
|
-
|
|
450
|
+
react.useEffect(() => {
|
|
451
451
|
return store.subscribe((nextState, prevState2, changedKeys) => {
|
|
452
452
|
if (prevState2.state === "INITIAL" && !prevState2.isPending && nextState.isPending && !nextState.isRetrying) {
|
|
453
453
|
return;
|
|
@@ -462,7 +462,7 @@ const createQuery = (queryFn, options = {}) => {
|
|
|
462
462
|
}
|
|
463
463
|
});
|
|
464
464
|
}, [store]);
|
|
465
|
-
|
|
465
|
+
react.useEffect(() => {
|
|
466
466
|
if (revalidateOnMount !== false) {
|
|
467
467
|
if (!initialDataIsStale) {
|
|
468
468
|
const dataInitiatedAt = initialDataInitiatedAt.current.get(store);
|