@octanejs/three 0.1.36 → 0.1.37

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 +6 -6
  2. package/src/core/hooks.ts +4 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/three",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -51,7 +51,7 @@
51
51
  "peerDependencies": {
52
52
  "@types/three": ">=0.156.0",
53
53
  "three": ">=0.156.0",
54
- "octane": "0.1.43"
54
+ "octane": "0.1.44"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "@types/three": {
@@ -72,10 +72,10 @@
72
72
  "typescript": "^5.9.3",
73
73
  "vite": "^8.1.5",
74
74
  "vitest": "^4.1.10",
75
- "@octanejs/vite-plugin": "0.1.43",
76
- "@octanejs/rsbuild-plugin": "0.1.38",
77
- "@octanejs/rspack-plugin": "0.1.38",
78
- "octane": "0.1.43"
75
+ "@octanejs/rsbuild-plugin": "0.1.39",
76
+ "@octanejs/vite-plugin": "0.1.44",
77
+ "@octanejs/rspack-plugin": "0.1.39",
78
+ "octane": "0.1.44"
79
79
  },
80
80
  "scripts": {
81
81
  "test": "pnpm upstream:check && vitest run --root ../.. --project three",
package/src/core/hooks.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import * as THREE from 'three';
10
10
  import {
11
+ createSubSlot,
11
12
  useContext,
12
13
  useLayoutEffect,
13
14
  useMemo,
@@ -39,25 +40,9 @@ export interface RefObject<T> {
39
40
  type EqualityFn<T> = (previous: T, next: T) => boolean;
40
41
  type Selector<T> = (state: RootState) => T;
41
42
 
42
- const subSlotCache = new Map<symbol, Map<string, symbol>>();
43
-
44
- function subSlot(slot: symbol | undefined, tag: string): symbol | undefined {
45
- // Universal hooks allocate an owner-local implicit slot when an uncompiled
46
- // caller provides no symbol. Preserve that fallback; a shared tag-only symbol
47
- // would make two direct calls to the same composed hook collide.
48
- if (slot === undefined) return undefined;
49
- let byTag = subSlotCache.get(slot);
50
- if (byTag === undefined) {
51
- byTag = new Map();
52
- subSlotCache.set(slot, byTag);
53
- }
54
- let result = byTag.get(tag);
55
- if (result === undefined) {
56
- result = Symbol.for(`${slot.description ?? ''}:@octanejs/three:${tag}`);
57
- byTag.set(tag, result);
58
- }
59
- return result;
60
- }
43
+ // Universal hooks preserve their owner-local implicit fallback when an
44
+ // uncompiled caller provides no symbol.
45
+ const subSlot = createSubSlot({ tagPrefix: ':@octanejs/three:' });
61
46
 
62
47
  function splitSlot(args: readonly unknown[]): [readonly unknown[], symbol | undefined] {
63
48
  const tail = args.at(-1);