@octanejs/redux 0.1.39 → 0.1.41

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/internal.ts +4 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/redux",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
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.42"
34
+ "octane": "0.1.44"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@reduxjs/toolkit": "^2.12.0",
@@ -42,7 +42,7 @@
42
42
  "react-redux": "9.3.0",
43
43
  "redux": "^5.0.1",
44
44
  "vitest": "^4.1.10",
45
- "octane": "0.1.42"
45
+ "octane": "0.1.44"
46
46
  },
47
47
  "scripts": {
48
48
  "test": "vitest run"
package/src/internal.ts CHANGED
@@ -6,27 +6,11 @@
6
6
 
7
7
  // Memoized: subSlot runs on EVERY hook call every render; the cache returns the
8
8
  // identical Symbol.for-interned value without the concat + registry lookup.
9
- const subSlotCache = new Map<symbol, Map<string, symbol>>();
10
- // Tag-only symbols for the slotless-caller case (see below).
11
- const bareTagCache = new Map<string, symbol>();
9
+ import { createSubSlot } from 'octane';
12
10
 
13
- export function subSlot(slot: symbol | undefined, tag: string): symbol {
14
- // No inherited slot (the caller was NOT compiled — e.g. a vendored wrapper
15
- // hook): return a stable TAG-ONLY symbol rather than undefined. The runtime
16
- // combines it with the ambient withSlot path, so sibling base hooks inside
17
- // one composed hook stay DISTINCT per tag. Returning undefined here made
18
- // them all resolve to the bare path — one shared slot, state collision.
19
- if (slot === undefined) {
20
- let bare = bareTagCache.get(tag);
21
- if (bare === undefined) bareTagCache.set(tag, (bare = Symbol.for(':' + tag)));
22
- return bare;
23
- }
24
- let byTag = subSlotCache.get(slot);
25
- if (byTag === undefined) subSlotCache.set(slot, (byTag = new Map()));
26
- let sym = byTag.get(tag);
27
- if (sym === undefined) byTag.set(tag, (sym = Symbol.for((slot.description ?? '') + ':' + tag)));
28
- return sym;
29
- }
11
+ // A stable tag-only symbol keeps sibling base hooks distinct when an
12
+ // uncompiled caller relies on the ambient withSlot path.
13
+ export const subSlot = createSubSlot({ slotlessPrefix: ':' });
30
14
 
31
15
  // Split the compiler-injected trailing slot off a hook's runtime args, returning
32
16
  // the user args (everything before it) and the slot.