@octanejs/tanstack-query 0.1.42 → 0.1.44

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/tanstack-query",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -40,7 +40,7 @@
40
40
  "@tanstack/query-core": "^5.101.3"
41
41
  },
42
42
  "peerDependencies": {
43
- "octane": "0.1.43"
43
+ "octane": "0.1.45"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@tanstack/react-query": "^5.101.3",
@@ -49,7 +49,7 @@
49
49
  "react": "^19.2.7",
50
50
  "react-dom": "^19.2.7",
51
51
  "vitest": "^4.1.10",
52
- "octane": "0.1.43"
52
+ "octane": "0.1.45"
53
53
  },
54
54
  "scripts": {
55
55
  "test": "vitest run"
package/src/internal.ts CHANGED
@@ -1,25 +1,8 @@
1
1
  // Shared internals for the binding hooks.
2
2
  import { shouldThrowError } from '@tanstack/query-core';
3
- import { use, useRef } from 'octane';
3
+ import { subSlot, use, useRef } from 'octane';
4
4
 
5
- // Derive a stable, distinct sub-slot from a wrapper's compiler-injected slot, so
6
- // a hook composing multiple base hooks gives each one its own identity. Tags are
7
- // namespaced per hook (e.g. ':oq:obs', ':ms:cb') to avoid cross-hook collisions.
8
- // Memoized: subSlot runs on EVERY hook call every render, and the naive form
9
- // pays a string concat + global symbol-registry lookup each time. The cache is
10
- // keyed by the slot symbol itself; the minted value is byte-identical to the
11
- // uncached Symbol.for result, so identity is preserved across HMR re-evals and
12
- // the per-package copies of this helper. Key universe is bounded: slots are
13
- // per-call-site module constants (never minted per render).
14
- const subSlotCache = new Map<symbol, Map<string, symbol>>();
15
- export function subSlot(slot: symbol | undefined, tag: string): symbol | undefined {
16
- if (slot === undefined) return undefined;
17
- let byTag = subSlotCache.get(slot);
18
- if (byTag === undefined) subSlotCache.set(slot, (byTag = new Map()));
19
- let sym = byTag.get(tag);
20
- if (sym === undefined) byTag.set(tag, (sym = Symbol.for((slot.description ?? '') + ':' + tag)));
21
- return sym;
22
- }
5
+ export { subSlot };
23
6
 
24
7
  // Split the compiler-injected trailing slot off a hook's runtime args, returning
25
8
  // the user args (everything before it) and the slot.
package/src/types.ts CHANGED
@@ -128,7 +128,8 @@ export type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQuer
128
128
 
129
129
  export type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<
130
130
  DefinedQueryObserverResult<TData, TError>,
131
- 'isPlaceholderData' | 'promise'
131
+ // Query core 5.102 removed the experimental promise result field.
132
+ Extract<'isPlaceholderData' | 'promise', keyof DefinedQueryObserverResult<TData, TError>>
132
133
  >;
133
134
 
134
135
  export type DefinedUseQueryResult<
@@ -148,7 +149,7 @@ export type DefinedUseInfiniteQueryResult<
148
149
 
149
150
  export type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<
150
151
  DefinedInfiniteQueryObserverResult<TData, TError>,
151
- 'isPlaceholderData' | 'promise'
152
+ Extract<'isPlaceholderData' | 'promise', keyof DefinedInfiniteQueryObserverResult<TData, TError>>
152
153
  >;
153
154
 
154
155
  export type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
@@ -133,10 +133,11 @@ export function useBaseQuery(
133
133
 
134
134
  (client.getDefaultOptions().queries as any)?._experimental_afterQuery?.(defaultedOptions, result);
135
135
 
136
- // experimental_prefetchInRender: kick the fetch during render so
137
- // `result.promise` settles even if the component unmounts, and finalize the
138
- // observer's thenable (via updateResult) when the data lands.
136
+ // Query core before 5.102 supports experimental_prefetchInRender. Start the
137
+ // fetch during render so `result.promise` settles even if the component
138
+ // unmounts, then finalize the observer's thenable when the data lands.
139
139
  if (
140
+ 'experimental_prefetchInRender' in defaultedOptions &&
140
141
  defaultedOptions.experimental_prefetchInRender &&
141
142
  !environmentManager.isServer() &&
142
143
  willFetch(result, isRestoring)