@t8/react-pending 1.0.20 → 1.0.21

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -40,7 +40,6 @@ import { useEffect, useMemo, useRef, useState } from "react";
40
40
  function useStore(store, shouldUpdate = true) {
41
41
  if (!isStore(store)) throw new Error("'store' is not an instance of Store");
42
42
  let [, setRevision] = useState(-1);
43
- let initedRef = useRef(false);
44
43
  let state = store.getState();
45
44
  let setState = useMemo(() => store.setState.bind(store), [store]);
46
45
  let initialStoreRevision = useRef(store.revision);
@@ -50,14 +49,10 @@ function useStore(store, shouldUpdate = true) {
50
49
  if (typeof shouldUpdate !== "function" || shouldUpdate(nextState, prevState))
51
50
  setRevision(Math.random());
52
51
  });
53
- if (!initedRef.current) {
54
- initedRef.current = true;
55
- if (store.revision !== initialStoreRevision.current)
56
- setRevision(Math.random());
57
- }
52
+ if (store.revision !== initialStoreRevision.current)
53
+ setRevision(Math.random());
58
54
  return () => {
59
55
  unsubscribe();
60
- initedRef.current = false;
61
56
  initialStoreRevision.current = store.revision;
62
57
  };
63
58
  }, [store, shouldUpdate]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/react-pending",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Concise async action state tracking for React apps",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -40,6 +40,6 @@
40
40
  "typescript": "^5.9.3"
41
41
  },
42
42
  "dependencies": {
43
- "@t8/react-store": "^1.0.30"
43
+ "@t8/react-store": "^1.0.31"
44
44
  }
45
45
  }