juststore 0.1.1 → 0.1.2

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/root.js +3 -2
  2. package/package.json +1 -1
package/dist/root.js CHANGED
@@ -35,9 +35,10 @@ function createStoreRoot(namespace, defaultValue, options = {}) {
35
35
  // eslint-disable-next-line react-hooks/rules-of-hooks
36
36
  useSubscribe(joinPath(namespace, path), listener),
37
37
  useCompute: (path, fn) => {
38
- const initialValue = getSnapshot(joinPath(namespace, path));
38
+ const fullPath = joinPath(namespace, path);
39
+ const initialValue = getSnapshot(fullPath);
39
40
  const [computedValue, setComputedValue] = useState(() => fn(initialValue));
40
- useSubscribe(path, value => {
41
+ useSubscribe(fullPath, value => {
41
42
  const newValue = fn(value);
42
43
  if (!isEqual(computedValue, newValue)) {
43
44
  setComputedValue(newValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juststore",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A small, expressive, and type-safe state management library for React.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",