@octanejs/tanstack-db 0.0.6 → 0.0.8
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 +4 -4
- package/src/slot.ts +2 -16
- package/src/useLiveSuspenseQuery.ts +4 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/tanstack-db",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@tanstack/db": "^0.7.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"octane": "0.1.
|
|
50
|
+
"octane": "0.1.45"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"vitest": "^4.1.10",
|
|
54
|
-
"@octanejs/testing-library": "0.1.
|
|
55
|
-
"octane": "0.1.
|
|
54
|
+
"@octanejs/testing-library": "0.1.42",
|
|
55
|
+
"octane": "0.1.45"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"test": "vitest run"
|
package/src/slot.ts
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { subSlot } from 'octane';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* Derive a stable sub-slot from a wrapper's compiler-injected slot so nested
|
|
5
|
-
* Octane hooks inside a custom hook each get distinct call-site identity.
|
|
6
|
-
*/
|
|
7
|
-
export function subSlot(slot: symbol | undefined, tag: string): symbol | undefined {
|
|
8
|
-
if (slot === undefined) return undefined;
|
|
9
|
-
let byTag = subSlotCache.get(slot);
|
|
10
|
-
if (byTag === undefined) subSlotCache.set(slot, (byTag = new Map()));
|
|
11
|
-
let sym = byTag.get(tag);
|
|
12
|
-
if (sym === undefined) {
|
|
13
|
-
sym = Symbol.for(`${slot.description ?? ``}:${tag}`);
|
|
14
|
-
byTag.set(tag, sym);
|
|
15
|
-
}
|
|
16
|
-
return sym;
|
|
17
|
-
}
|
|
3
|
+
export { subSlot };
|
|
18
4
|
|
|
19
5
|
/** Split a compiler-injected trailing slot symbol off hook runtime args. */
|
|
20
6
|
export function splitTrailingSlot<T extends Array<unknown>>(
|
|
@@ -221,14 +221,12 @@ export function useLiveSuspenseQuery(configOrQueryOrCollection: any, ...rest: Ar
|
|
|
221
221
|
throw new Error(`Collection "${result.collection.id}" failed to load`);
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
// OCTANE
|
|
224
|
+
// OCTANE ADAPTATION: consume the preload promise through `use(thenable)`, and call
|
|
225
225
|
// `use()` UNCONDITIONALLY — exactly once on every path that keeps rendering.
|
|
226
226
|
//
|
|
227
|
-
// Upstream react-db
|
|
228
|
-
// the
|
|
229
|
-
//
|
|
230
|
-
// error path and never renders the fallback), and Octane tracks `use(thenable)`
|
|
231
|
-
// by dynamic call-order index (the runtime's `__thenableIdx`), like React's
|
|
227
|
+
// Upstream react-db throws the preload promise; Octane supports that too.
|
|
228
|
+
// This binding uses the public hook, whose thenable state is tracked by
|
|
229
|
+
// dynamic call-order index (the runtime's `__thenableIdx`), like React's
|
|
232
230
|
// positional `thenableState` — NOT by compiler slot. So skipping `use()` on the
|
|
233
231
|
// ready / stale-after-error paths would shift the thenable index of any sibling
|
|
234
232
|
// `use()` or second `useLiveSuspenseQuery` in the same component, which could
|