juststore 0.1.1 → 0.1.3

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/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/dist/types.d.ts CHANGED
@@ -102,7 +102,7 @@ type State<T> = {
102
102
  children: React.ReactNode;
103
103
  on: (value: T) => boolean;
104
104
  }) => React.ReactNode;
105
- };
105
+ } & (NonNullable<T> extends readonly (infer U)[] ? ArrayProxy<U> : unknown);
106
106
  /** Props for Store.Render helper. */
107
107
  type StoreRenderProps<T extends FieldValues, P extends FieldPath<T>> = {
108
108
  path: P;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juststore",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A small, expressive, and type-safe state management library for React.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",