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 +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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;
|