@octanejs/redux 0.1.3 → 0.1.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/redux",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"redux": "^5.0.0",
|
|
34
|
-
"octane": "0.1.
|
|
34
|
+
"octane": "0.1.9"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@reduxjs/toolkit": "^2.9.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"react-redux": "9.3.0",
|
|
43
43
|
"redux": "^5.0.1",
|
|
44
44
|
"vitest": "^4.1.9",
|
|
45
|
-
"octane": "0.1.
|
|
45
|
+
"octane": "0.1.9"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"test": "vitest run"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// selection matches the previous one, the previous REFERENCE is kept so the
|
|
5
5
|
// store's uSES doesn't re-render.
|
|
6
6
|
import { useSyncExternalStore, useRef, useMemo, useEffect } from 'octane';
|
|
7
|
-
import { subSlot } from '../internal';
|
|
7
|
+
import { splitSlot, subSlot } from '../internal';
|
|
8
8
|
|
|
9
9
|
const objectIs: (x: unknown, y: unknown) => boolean =
|
|
10
10
|
typeof Object.is === 'function'
|
|
@@ -16,9 +16,14 @@ export function useSyncExternalStoreWithSelector<Snapshot, Selection>(
|
|
|
16
16
|
getSnapshot: () => Snapshot,
|
|
17
17
|
getServerSnapshot: undefined | null | (() => Snapshot),
|
|
18
18
|
selector: (snapshot: Snapshot) => Selection,
|
|
19
|
-
isEqual?: (a: Selection, b: Selection) => boolean,
|
|
20
|
-
slot?: symbol,
|
|
19
|
+
...rest: [isEqual?: (a: Selection, b: Selection) => boolean, slot?: symbol]
|
|
21
20
|
): Selection {
|
|
21
|
+
// A compiled direct call that omits the optional equality function arrives as
|
|
22
|
+
// `[slot]`, while binding-internal calls arrive as `[isEqual, slot]`. Split the
|
|
23
|
+
// compiler-owned tail before interpreting the user argument so a Symbol can
|
|
24
|
+
// never be mistaken for an equality function.
|
|
25
|
+
const [userArgs, slot] = splitSlot(rest);
|
|
26
|
+
const isEqual = userArgs[0] as ((a: Selection, b: Selection) => boolean) | undefined;
|
|
22
27
|
const instRef = useRef<{ hasValue: boolean; value: Selection | null } | null>(
|
|
23
28
|
null,
|
|
24
29
|
subSlot(slot, 'ws:inst'),
|