floppy-disk 3.7.2 → 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 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
- useIsomorphicLayoutEffect(() => {
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
- useIsomorphicLayoutEffect(() => {
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,9 +445,9 @@ const createQuery = (queryFn, options = {}) => {
445
445
  ) : storeStateToBeUsed
446
446
  );
447
447
  const [, reRender] = useState({});
448
- useIsomorphicLayoutEffect(() => {
448
+ useEffect(() => {
449
449
  return store.subscribe((nextState, prevState2, changedKeys) => {
450
- if (prevState2.state === "INITIAL" && !prevState2.isPending && nextState.isPending) {
450
+ if (prevState2.state === "INITIAL" && !prevState2.isPending && nextState.isPending && !nextState.isRetrying) {
451
451
  return;
452
452
  }
453
453
  const paths = compressPaths(usedPathsRef.current);
@@ -460,7 +460,7 @@ const createQuery = (queryFn, options = {}) => {
460
460
  }
461
461
  });
462
462
  }, [store]);
463
- useIsomorphicLayoutEffect(() => {
463
+ useEffect(() => {
464
464
  if (revalidateOnMount !== false) {
465
465
  if (!initialDataIsStale) {
466
466
  const dataInitiatedAt = initialDataInitiatedAt.current.get(store);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "floppy-disk",
3
3
  "description": "Lightweight unified state management for sync and async data.",
4
4
  "private": false,
5
- "version": "3.7.2",
5
+ "version": "3.8.0",
6
6
  "keywords": [
7
7
  "utilities",
8
8
  "store",
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
- useIsomorphicLayoutEffect(() => {
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
- useIsomorphicLayoutEffect(() => {
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,9 +447,9 @@ const createQuery = (queryFn, options = {}) => {
447
447
  ) : storeStateToBeUsed
448
448
  );
449
449
  const [, reRender] = react.useState({});
450
- useIsomorphicLayoutEffect(() => {
450
+ react.useEffect(() => {
451
451
  return store.subscribe((nextState, prevState2, changedKeys) => {
452
- if (prevState2.state === "INITIAL" && !prevState2.isPending && nextState.isPending) {
452
+ if (prevState2.state === "INITIAL" && !prevState2.isPending && nextState.isPending && !nextState.isRetrying) {
453
453
  return;
454
454
  }
455
455
  const paths = compressPaths(usedPathsRef.current);
@@ -462,7 +462,7 @@ const createQuery = (queryFn, options = {}) => {
462
462
  }
463
463
  });
464
464
  }, [store]);
465
- useIsomorphicLayoutEffect(() => {
465
+ react.useEffect(() => {
466
466
  if (revalidateOnMount !== false) {
467
467
  if (!initialDataIsStale) {
468
468
  const dataInitiatedAt = initialDataInitiatedAt.current.get(store);