@octanejs/redux 0.1.2 → 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,8 +1,11 @@
1
1
  {
2
2
  "name": "@octanejs/redux",
3
- "version": "0.1.2",
3
+ "version": "0.1.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
+ "engines": {
7
+ "node": ">=22"
8
+ },
6
9
  "description": "React Redux for the octane renderer — the Provider/hooks binding layer reimplemented on octane's useSyncExternalStore; works with any Redux store (Redux Toolkit included) by changing the import.",
7
10
  "author": {
8
11
  "name": "Dominic Gannaway",
@@ -26,11 +29,9 @@
26
29
  "exports": {
27
30
  ".": "./src/index.ts"
28
31
  },
29
- "dependencies": {
30
- "octane": "0.1.5"
31
- },
32
32
  "peerDependencies": {
33
- "redux": "^5.0.0"
33
+ "redux": "^5.0.0",
34
+ "octane": "0.1.9"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@reduxjs/toolkit": "^2.9.0",
@@ -40,7 +41,8 @@
40
41
  "react-dom": "^19.2.0",
41
42
  "react-redux": "9.3.0",
42
43
  "redux": "^5.0.1",
43
- "vitest": "^4.1.9"
44
+ "vitest": "^4.1.9",
45
+ "octane": "0.1.9"
44
46
  },
45
47
  "scripts": {
46
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'),