small-state-react 0.2.0 → 0.2.1

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/index.cjs CHANGED
@@ -28,12 +28,12 @@ function useRuntimeHandle(machine, options) {
28
28
  const getSnapshot = (0, react.useCallback)(() => runtime.getSnapshot(), [runtime]);
29
29
  snapshot = (0, react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
30
30
  }
31
- return {
32
- snapshot,
33
- send: (event) => void runtime.send.apply(runtime, [event]),
34
- runtime,
35
- useBoundSend: readyToUseBoundSend(rtRef)
36
- };
31
+ const handle = (0, react.useRef)({}).current;
32
+ handle.snapshot = snapshot;
33
+ handle.send = (event) => void runtime.send.apply(runtime, [event]);
34
+ handle.runtime = runtime;
35
+ handle.useBoundSend = readyToUseBoundSend(rtRef);
36
+ return handle;
37
37
  }
38
38
  // src/react/useSelectedSnapshot.ts
39
39
  const DEFAULT_COMPARE = (a, b) => a === b;
package/dist/index.mjs CHANGED
@@ -27,12 +27,12 @@ function useRuntimeHandle(machine, options) {
27
27
  const getSnapshot = useCallback(() => runtime.getSnapshot(), [runtime]);
28
28
  snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
29
29
  }
30
- return {
31
- snapshot,
32
- send: (event) => void runtime.send.apply(runtime, [event]),
33
- runtime,
34
- useBoundSend: readyToUseBoundSend(rtRef)
35
- };
30
+ const handle = useRef({}).current;
31
+ handle.snapshot = snapshot;
32
+ handle.send = (event) => void runtime.send.apply(runtime, [event]);
33
+ handle.runtime = runtime;
34
+ handle.useBoundSend = readyToUseBoundSend(rtRef);
35
+ return handle;
36
36
  }
37
37
  // src/react/useSelectedSnapshot.ts
38
38
  const DEFAULT_COMPARE = (a, b) => a === b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "small-state-react",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "React and Jotai bindings for small-state, a lightweight state machine library.",
5
5
  "author": "qyvvy",
6
6
  "license": "MIT",