@tanstack/solid-query 6.0.0-rc.0 → 6.0.0-rc.2

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/README.md CHANGED
@@ -1,6 +1,20 @@
1
1
  <img src="https://static.scarf.sh/a.png?x-pxid=be2d8a11-9712-4c1d-9963-580b2d4fb133" />
2
2
 
3
- ![TanStack Query Header](https://github.com/TanStack/query/raw/main/media/repo-header.png)
3
+ <picture>
4
+ <source
5
+ media="(prefers-color-scheme: dark)"
6
+ srcset="https://tanstack.com/api/readme/query.png?framework=solid&theme=dark"
7
+ />
8
+ <source
9
+ media="(prefers-color-scheme: light)"
10
+ srcset="https://tanstack.com/api/readme/query.png?framework=solid"
11
+ />
12
+ <img
13
+ src="https://tanstack.com/api/readme/query.png?framework=solid"
14
+ alt="TanStack Solid Query"
15
+ width="900"
16
+ />
17
+ </picture>
4
18
 
5
19
  Hooks for fetching, caching and updating asynchronous data in Solid
6
20
 
@@ -143,54 +143,55 @@ import { WithRequired } from '@tanstack/query-core';
143
143
 
144
144
  export { AnyDataTag }
145
145
 
146
+ /** Internal seam: everything the read layer builds, for hooks that extend
147
+ * the base result (`useInfiniteQuery` pagers ride the same entry). */
148
+ declare interface BaseQueryLayer<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey> {
149
+ result: UseBaseQueryResult<TData, TError>;
150
+ observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>;
151
+ /** Version-tracked: reading it subscribes to this query's cache events. */
152
+ query: () => Query<TQueryFnData, TError, TQueryData, TQueryKey>;
153
+ defaultedOptions: Accessor<ReturnType<QueryClient['defaultQueryOptions']>>;
154
+ isFetching: () => boolean;
155
+ status: () => 'pending' | 'error' | 'success';
156
+ }
157
+
146
158
  export { CancelledError }
147
159
 
148
160
  export { CancelOptions }
149
161
 
150
162
  /**
151
- * Client side of the channel. Created by `QueryClientProvider` on the
152
- * client and handed to `useBaseQuery` via context so hydrated components
153
- * can attach their observers as soon as their query's entry has been
154
- * primed — per query, not at global hydration end, which keeps
155
- * early-hydrated components live while other boundaries still stream.
156
- */
157
- export declare function createHydrationCoordinator(client: () => QueryClient): HydrationCoordinator;
158
-
159
- export declare const createInfiniteQuery: typeof useInfiniteQuery;
160
-
161
- export declare const createMutation: typeof useMutation;
162
-
163
- export declare const createQueries: typeof useQueries;
164
-
165
- export declare const createQuery: typeof useQuery;
166
-
167
- /**
168
- * Server side of the library-owned serialization channel.
163
+ * Shared reactive core for the cross-cache aggregate hooks — `useIsFetching`,
164
+ * `useIsMutating`, `useMutationState` — which all reduce to "a value derived
165
+ * from a whole cache, refreshed on its events". Two invariants live here so
166
+ * each hook doesn't restate them:
169
167
  *
170
- * Returns an AsyncIterable that yields a cumulative snapshot of the
171
- * dehydrated query cache (success entries, per query-core `dehydrate()`
172
- * shapes) every time a query settles during SSR. `QueryClientProvider`
173
- * holds it as a signal value, so Solid serializes it through the normal
174
- * per-computation path: the server runtime tees the iterator into the
175
- * hydration serializer (`ctx.serialize(id, tapped)` in solid-js'
176
- * `processResult`) and seroval streams each yield to the client as a
177
- * script chunk riding the SSR stream.
168
+ * Dual write. Cache events can fire inside an action transaction
169
+ * (`useMutation` rides core `action`; an onSuccess invalidation dispatches
170
+ * refetches mid-action), where a plain signal write is held until settle —
171
+ * the in-flight value would be invisible. An optimistic override alone fails
172
+ * the other way: outside a transaction, overrides drop at batch end. So a
173
+ * durable signal carries committed state and an optimistic node tracks it as
174
+ * its base; in-transaction values surface through the override, and the held
175
+ * durable write becomes the base when the settle lands.
178
176
  *
179
- * The iterable must terminate for the SSR stream to complete: the
180
- * hydration serializer's `flush()` only fires its `onDone` once all
181
- * pending streams have closed, and the render root is disposed *after*
182
- * that, so neither `onCleanup` nor the serializer itself can close the
183
- * channel. Instead the channel closes itself on cache quiescence: after
184
- * every cache event (and once at creation) it schedules a timer-task
185
- * check; if no query is fetching by then, no further settle can occur —
186
- * suspense retry passes that start waterfall fetches are scheduled on
187
- * microtasks, so they have begun before the check runs — and the channel
188
- * emits its final cumulative snapshot with `done: true` and completes.
177
+ * Hydration. A cross-cache aggregate is not tied to a single async source,
178
+ * so it cannot ride the boundary contract per-query meta uses (suspend until
179
+ * settled). Its contract is fixed by construction instead: a hydrating
180
+ * client can only ever observe the empty value at claim time — its own
181
+ * fetches are held inside the hydration window, channel-primed entries are
182
+ * settled, and mutations do not transfer across SSR. So the server
183
+ * serializes the empty value, and a hydrated mount latches there until its
184
+ * window closes: the subscription and first sync run from an effect half,
185
+ * deferred past hydration — the earliest globally-safe moment for a
186
+ * cross-cache read to go live (on a streamed page, an already-hydrated
187
+ * region's refetch can be in flight while this region is still claiming).
189
188
  *
190
- * Single-consumer by design: solid-js creates exactly one iterator from
191
- * the value and shares it between the memo and the serializer tap.
189
+ * Every node here is created on the server too, where it is never read or
190
+ * written: hydration id assignment is positional, so both sides must create
191
+ * the same reactive nodes or every id downstream shifts and the subtree
192
+ * key-misses.
192
193
  */
193
- export declare function createServerDehydrationChannel(client: QueryClient): AsyncIterable<DehydrationChannelYield>;
194
+ export declare function createCacheAggregate<T>(subscribe: (onEvent: () => void) => () => void, read: (prev: T) => T, empty: T): Accessor<T>;
194
195
 
195
196
  export { DataTag }
196
197
 
@@ -232,56 +233,50 @@ export { DefinedInitialDataOptions as DefinedInitialDataOptions_alias_1 }
232
233
 
233
234
  export { DefinedQueryObserverResult }
234
235
 
235
- declare type DefinedUseBaseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
236
- export { DefinedUseBaseQueryResult as DefinedCreateBaseQueryResult }
236
+ declare type DefinedUseBaseQueryResult<TData = unknown, TError = DefaultError> = OmitIsInitialLoading<DefinedQueryObserverResult<TData, TError>>;
237
237
  export { DefinedUseBaseQueryResult }
238
238
  export { DefinedUseBaseQueryResult as DefinedUseBaseQueryResult_alias_1 }
239
239
 
240
- declare type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>;
241
- export { DefinedUseInfiniteQueryResult as DefinedCreateInfiniteQueryResult }
240
+ declare type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitIsInitialLoading<DefinedInfiniteQueryObserverResult<TData, TError>>;
242
241
  export { DefinedUseInfiniteQueryResult }
243
242
  export { DefinedUseInfiniteQueryResult as DefinedUseInfiniteQueryResult_alias_1 }
244
243
 
245
244
  declare type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedUseBaseQueryResult<TData, TError>;
246
- export { DefinedUseQueryResult as DefinedCreateQueryResult }
247
245
  export { DefinedUseQueryResult }
248
246
  export { DefinedUseQueryResult as DefinedUseQueryResult_alias_1 }
249
247
 
250
248
  export { dehydrate }
251
249
 
252
- declare type DehydratedQueryEntry = DehydratedState['queries'][number];
253
-
254
250
  export { DehydratedState }
255
251
 
256
252
  export { DehydrateOptions }
257
253
 
258
254
  /**
259
- * A single message on the dehydration channel. `entries` is *cumulative* —
260
- * every yield carries all entries settled so far. Two reasons:
255
+ * Waits for every fetch the client has in flight to settle, then
256
+ * dehydrates. This is the extraction half of a single-flight collector:
257
+ * after route data functions run for the mutation's target URL, loaders
258
+ * commonly kick off prefetches without awaiting them — plain
259
+ * `dehydrate()` would snapshot those mid-fetch and ship nothing.
261
260
  *
262
- * - It is what makes Solid's signal-path hydration replay lossless.
263
- * Yields still buffered when hydration begins are conflated to the
264
- * LATEST one (`normalizeIterator` drains synchronously available
265
- * results, keeps the last data yield, and delivers the stream's done
266
- * result on a subsequent pull), so each yield must be self-contained:
267
- * the latest cumulative snapshot alone carries everything the dropped
268
- * intermediates did. Requires the solid-js build with that conflation
269
- * behavior (> 2.0.0-beta.32); earlier betas pinned the replay at the
270
- * FIRST buffered yield, dropping every later entry and the `done`
271
- * marker.
272
- * - Entry objects keep their identity across yields, so seroval's
273
- * cross-reference serialization emits each entry once and later yields
274
- * only reference it — the cumulative shape costs bytes proportional to
275
- * the number of entries, not its square.
261
+ * ```ts
262
+ * registerFlightDataSource(FLIGHT_DATA_SOURCE, (event, outcome) =>
263
+ * loadFlightTarget({
264
+ * router,
265
+ * event,
266
+ * outcome,
267
+ * collect: () => dehydrateSettled(queryClient),
268
+ * }),
269
+ * )
270
+ * ```
276
271
  *
277
- * `done: true` marks the final yield. The client uses it to release
278
- * subscribers still waiting for entries that will never arrive (e.g.
279
- * queries that errored during SSR and were not dehydrated).
272
+ * Settling is chased to quiescence — awaiting one batch of fetches can
273
+ * dispatch more (dependent queries keyed off a first result) — so an
274
+ * unconditionally self-refetching query would keep this pending; that's
275
+ * an app bug mirrored, not guarded.
280
276
  */
281
- export declare interface DehydrationChannelYield {
282
- entries: Array<DehydratedQueryEntry>;
283
- done: boolean;
284
- }
277
+ declare function dehydrateSettled(client: QueryClient, options?: DehydrateOptions): Promise<DehydratedState>;
278
+ export { dehydrateSettled }
279
+ export { dehydrateSettled as dehydrateSettled_alias_1 }
285
280
 
286
281
  export { DistributiveOmit }
287
282
 
@@ -303,6 +298,31 @@ export { FetchQueryOptions }
303
298
 
304
299
  export { FetchStatus }
305
300
 
301
+ /**
302
+ * The query cache's single-flight source id. Mutation responses can fold
303
+ * fresh data for multiple caches at once (Solid's multi-source
304
+ * single-flight protocol); this is the slice the query cache claims — the
305
+ * provider subscribes its consumer under it, and server collectors
306
+ * register under it to produce the data:
307
+ *
308
+ * ```ts
309
+ * import { registerFlightDataSource } from '@solidjs/web/server-functions/server'
310
+ * import { FLIGHT_DATA_SOURCE, dehydrate } from '@tanstack/solid-query'
311
+ *
312
+ * registerFlightDataSource(FLIGHT_DATA_SOURCE, async (event, outcome) => {
313
+ * // rebuild the data for outcome.targetUrl into a QueryClient, then
314
+ * return dehydrate(queryClient)
315
+ * })
316
+ * ```
317
+ *
318
+ * The slice's payload is a `DehydratedState`; the provider consumes it
319
+ * with `hydrate()`, so every mounted query on those keys updates before
320
+ * the mutation's promise resolves — no follow-up refetches.
321
+ */
322
+ declare const FLIGHT_DATA_SOURCE = "sq";
323
+ export { FLIGHT_DATA_SOURCE }
324
+ export { FLIGHT_DATA_SOURCE as FLIGHT_DATA_SOURCE_alias_1 }
325
+
306
326
  export { focusManager }
307
327
 
308
328
  export { GetNextPageParamFunction }
@@ -347,23 +367,13 @@ export { hydrate }
347
367
 
348
368
  export { HydrateOptions }
349
369
 
350
- declare interface HydrationCoordinator {
351
- /**
352
- * Prime the QueryClient from a channel yield. Entries already applied
353
- * (same queryHash and dataUpdatedAt) are skipped; the rest go through
354
- * query-core `hydrate()`, which keeps whichever data is newer.
355
- */
356
- applyYield: (value: DehydrationChannelYield) => void;
357
- /**
358
- * Invoke `callback` (on a microtask) once the entry for `queryHash` has
359
- * been applied — or immediately-on-a-microtask if it already was, or
360
- * when the channel completes without one (SSR-errored queries are not
361
- * dehydrated, so their components must not wait forever).
362
- */
363
- whenQueryPrimed: (queryHash: string, callback: () => void) => void;
364
- }
365
-
366
- export declare const HydrationCoordinatorContext: Context<HydrationCoordinator | null>;
370
+ /**
371
+ * Namespace prefix for cache entries in Solid's hydration registry — the
372
+ * registry is shared with positional node ids and other libraries'
373
+ * content-addressed keys (Solid Router uses its own cache keys), so query
374
+ * hashes get their own prefix.
375
+ */
376
+ export declare const HYDRATION_KEY_PREFIX = "sq:";
367
377
 
368
378
  export { InferDataFromTag }
369
379
 
@@ -379,15 +389,7 @@ export { InfiniteQueryObserverLoadingErrorResult }
379
389
 
380
390
  export { InfiniteQueryObserverLoadingResult }
381
391
 
382
- declare interface InfiniteQueryObserverOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions_2<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'structuralSharing'> {
383
- /**
384
- * Set this to a reconciliation key to enable reconciliation between query results.
385
- * Set this to `false` to disable reconciliation between query results.
386
- * Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
387
- * Defaults reconciliation to false.
388
- */
389
- reconcile?: string | false | ((oldData: TData | undefined, newData: TData) => TData);
390
- }
392
+ declare type InfiniteQueryObserverOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = InfiniteQueryObserverOptions_2<TQueryFnData, TError, TData, TQueryKey, TPageParam>;
391
393
  export { InfiniteQueryObserverOptions }
392
394
  export { InfiniteQueryObserverOptions as InfiniteQueryObserverOptions_alias_1 }
393
395
 
@@ -404,18 +406,16 @@ export { InfiniteQueryObserverSuccessResult }
404
406
  declare interface InfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryKey' | 'suspense'> {
405
407
  queryKey: TQueryKey;
406
408
  /**
407
- * Only applicable while rendering queries on the server with streaming.
408
- * Set `deferStream` to `true` to wait for the query to resolve on the server before flushing the stream.
409
- * This can be useful to avoid sending a loading state to the client before the query has resolved.
410
- * Defaults to `false`.
409
+ * Defer the SSR stream flush until this query resolves on the server —
410
+ * see {@link UseBaseQueryOptions.deferStream}.
411
411
  */
412
412
  deferStream?: boolean;
413
413
  /**
414
- * @deprecated The `suspense` option has been deprecated in v5 and will be removed in the next major version.
415
- * The `data` property on useInfiniteQuery is a SolidJS resource and will automatically suspend when the data is loading.
416
- * Setting `suspense` to `false` will be a no-op.
414
+ * Reconciliation key for the data store — see
415
+ * {@link UseBaseQueryOptions.reconcile}. For infinite queries this keys
416
+ * items within pages; pages themselves merge positionally.
417
417
  */
418
- suspense?: boolean;
418
+ reconcile?: string | ((item: NonNullable<any>) => any) | null;
419
419
  }
420
420
  export { InfiniteQueryOptions }
421
421
  export { InfiniteQueryOptions as InfiniteQueryOptions_alias_1 }
@@ -530,6 +530,12 @@ export { notifyManager }
530
530
 
531
531
  export { NotifyOnChangeProps }
532
532
 
533
+ /**
534
+ * Distributes an `isInitialLoading` omit over result unions so status
535
+ * discriminants survive (a plain Omit over a union collapses it).
536
+ */
537
+ declare type OmitIsInitialLoading<T> = T extends unknown ? OmitKeyof<T, 'isInitialLoading' & keyof T> : never;
538
+
533
539
  export { OmitKeyof }
534
540
 
535
541
  export { onlineManager }
@@ -598,6 +604,18 @@ declare const QueryClientContext: Context<(() => QueryClient) | null>;
598
604
  export { QueryClientContext }
599
605
  export { QueryClientContext as QueryClientContext_alias_1 }
600
606
 
607
+ /**
608
+ * Provides the QueryClient and manages its mount lifecycle. On the server
609
+ * it also registers the cache serializer above; on the client, hooks prime
610
+ * the cache from their hash-keyed registry entries themselves (see
611
+ * `useBaseQuery`) and the provider subscribes the cache's single-flight
612
+ * consumer: mutation responses carrying a `FLIGHT_DATA_SOURCE` slice (a
613
+ * `DehydratedState` produced by a server collector registered under the
614
+ * same id) hydrate this client before the mutation's promise resolves.
615
+ * Subscribing is inert when no server collector exists — the server just
616
+ * folds nothing — so it is unconditional. One consumer per source: with
617
+ * nested providers, the innermost mounted one owns the slice.
618
+ */
601
619
  declare const QueryClientProvider: (props: QueryClientProviderProps) => JSX.Element;
602
620
  export { QueryClientProvider }
603
621
  export { QueryClientProvider as QueryClientProvider_alias_1 }
@@ -629,15 +647,14 @@ export { QueryObserverLoadingErrorResult }
629
647
 
630
648
  export { QueryObserverLoadingResult }
631
649
 
632
- declare interface QueryObserverOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = never> extends OmitKeyof<QueryObserverOptions_2<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>, 'structuralSharing'> {
633
- /**
634
- * Set this to a reconciliation key to enable reconciliation between query results.
635
- * Set this to `false` to disable reconciliation between query results.
636
- * Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
637
- * Defaults reconciliation to false.
638
- */
639
- reconcile?: string | false | ((oldData: TData | undefined, newData: TData) => TData);
640
- }
650
+ /**
651
+ * Core observer options pass through unchanged. The old adapter omitted
652
+ * `structuralSharing` and replaced it with a store-level `reconcile`
653
+ * option; with reads derived directly from cache state, core's
654
+ * cache-level structural sharing is exactly what keeps the data memo
655
+ * referentially stable, so it is exposed again and `reconcile` is gone.
656
+ */
657
+ declare type QueryObserverOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = never> = QueryObserverOptions_2<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>;
641
658
  export { QueryObserverOptions }
642
659
  export { QueryObserverOptions as QueryObserverOptions_alias_1 }
643
660
 
@@ -724,38 +741,49 @@ export { unsetMarker }
724
741
 
725
742
  export { Updater }
726
743
 
727
- declare type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, {
744
+ declare type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<OmitKeyof<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, 'context'>, {
728
745
  mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult>;
729
- }> & {
730
- mutateAsync: UseMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult>;
731
- };
732
- export { UseBaseMutationResult as CreateBaseMutationResult }
746
+ }>;
733
747
  export { UseBaseMutationResult }
734
748
  export { UseBaseMutationResult as UseBaseMutationResult_alias_1 }
735
749
 
736
- export declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: Accessor<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>>, Observer: typeof QueryObserver, queryClient?: Accessor<QueryClient>): Readonly<QueryObserverResult<TData, TError>>;
750
+ export declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: Accessor<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>>, Observer: typeof QueryObserver, queryClient?: Accessor<QueryClient>): UseBaseQueryResult<TData, TError>;
751
+
752
+ export declare function useBaseQueryLayer<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: Accessor<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>>, Observer: typeof QueryObserver, queryClient?: Accessor<QueryClient>): BaseQueryLayer<TQueryFnData, TError, TData, TQueryData, TQueryKey>;
737
753
 
738
754
  declare interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, 'suspense'> {
739
755
  /**
740
- * Only applicable while rendering queries on the server with streaming.
741
- * Set `deferStream` to `true` to wait for the query to resolve on the server before flushing the stream.
742
- * This can be useful to avoid sending a loading state to the client before the query has resolved.
743
- * Defaults to `false`.
756
+ * Defer the SSR stream flush until this query resolves on the server,
757
+ * instead of letting the surrounding `<Loading>` boundary render its
758
+ * fallback into the HTML. Passed through to Solid's own per-computation
759
+ * `deferStream` option; server-only, ignored on the client.
744
760
  */
745
761
  deferStream?: boolean;
746
762
  /**
747
- * @deprecated The `suspense` option has been deprecated in v5 and will be removed in the next major version.
748
- * The `data` property on useQuery is a SolidJS resource and will automatically suspend when the data is loading.
749
- * Setting `suspense` to `false` will be a no-op.
763
+ * Reconciliation key for the data store. `data` is served as a Solid
764
+ * store projection: every landing (refetch, invalidation, placeholder
765
+ * upgrade) reconciles into the existing proxy graph instead of replacing
766
+ * it, so deep reads are fine-grained and item identity survives across
767
+ * fetches. This sets the identity key for that reconciliation — a
768
+ * property name, a key-extraction function, or `null` to merge
769
+ * positionally. Defaults to `'id'`. Read once at creation.
750
770
  */
751
- suspense?: boolean;
771
+ reconcile?: string | ((item: NonNullable<any>) => any) | null;
752
772
  }
753
- export { UseBaseQueryOptions as CreateBaseQueryOptions }
754
773
  export { UseBaseQueryOptions }
755
774
  export { UseBaseQueryOptions as UseBaseQueryOptions_alias_1 }
756
775
 
757
- declare type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
758
- export { UseBaseQueryResult as CreateBaseQueryResult }
776
+ /**
777
+ * `data` is non-optional: it is a suspending async read. It never returns
778
+ * `undefined` — a read either suspends into the nearest `<Loading>`
779
+ * boundary (first fetch in flight, disabled, restoring), returns a value
780
+ * (committed, placeholder, initial), or throws (`<Errored>` /
781
+ * `throwOnError`). The v5 `TData | undefined` face existed because reads
782
+ * could observe the pre-fetch gap; here that gap is suspension.
783
+ */
784
+ declare type UseBaseQueryResult<TData = unknown, TError = DefaultError> = Override<OmitKeyof<QueryObserverResult<TData, TError>, 'isInitialLoading'>, {
785
+ data: TData;
786
+ }>;
759
787
  export { UseBaseQueryResult }
760
788
  export { UseBaseQueryResult as UseBaseQueryResult_alias_1 }
761
789
 
@@ -766,22 +794,21 @@ export { useInfiniteQuery }
766
794
  export { useInfiniteQuery as useInfiniteQuery_alias_1 }
767
795
 
768
796
  declare type UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = Accessor<InfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>;
769
- export { UseInfiniteQueryOptions as CreateInfiniteQueryOptions }
770
797
  export { UseInfiniteQueryOptions }
771
798
  export { UseInfiniteQueryOptions as UseInfiniteQueryOptions_alias_1 }
772
799
 
773
- declare type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
774
- export { UseInfiniteQueryResult as CreateInfiniteQueryResult }
800
+ /** Non-optional `data` for the same reason as {@link UseBaseQueryResult}. */
801
+ declare type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = Override<OmitKeyof<InfiniteQueryObserverResult<TData, TError>, 'isInitialLoading'>, {
802
+ data: TData;
803
+ }>;
775
804
  export { UseInfiniteQueryResult }
776
805
  export { UseInfiniteQueryResult as UseInfiniteQueryResult_alias_1 }
777
806
 
778
807
  declare function useIsFetching(filters?: Accessor<QueryFilters>, queryClient?: Accessor<QueryClient>): Accessor<number>;
779
- export { useIsFetching as createIsFetching }
780
808
  export { useIsFetching }
781
809
  export { useIsFetching as useIsFetching_alias_1 }
782
810
 
783
811
  declare function useIsMutating(filters?: Accessor<MutationFilters>, queryClient?: Accessor<QueryClient>): Accessor<number>;
784
- export { useIsMutating as createIsMutating }
785
812
  export { useIsMutating }
786
813
  export { useIsMutating as useIsMutating_alias_1 }
787
814
 
@@ -789,36 +816,62 @@ declare const useIsRestoring: () => Accessor<boolean>;
789
816
  export { useIsRestoring }
790
817
  export { useIsRestoring as useIsRestoring_alias_1 }
791
818
 
792
- declare type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>;
793
- export { UseMutateAsyncFunction as CreateMutateAsyncFunction }
794
- export { UseMutateAsyncFunction }
795
- export { UseMutateAsyncFunction as UseMutateAsyncFunction_alias_1 }
796
-
797
- declare type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void;
798
- export { UseMutateFunction as CreateMutateFunction }
819
+ /**
820
+ * One `mutate`, returning a safe-to-ignore promise: errors are also routed
821
+ * into reactive state, and ignoring the promise never surfaces an
822
+ * unhandled rejection. Call-site callbacks are gone — settle logic that
823
+ * used to live in `mutate(vars, { onSuccess })` is linear code after
824
+ * `await mutate(vars)` or a config-level callback.
825
+ */
826
+ declare type UseMutateFunction<TData = unknown, _TError = DefaultError, TVariables = void, _TOnMutateResult = unknown> = (variables: TVariables) => Promise<TData>;
799
827
  export { UseMutateFunction }
800
828
  export { UseMutateFunction as UseMutateFunction_alias_1 }
801
829
 
830
+ /**
831
+ * Mutations ride core `action`: each `mutate()` call is one transaction.
832
+ *
833
+ * - Transient flight state (`isPending`, in-flight `variables`) is a
834
+ * `createOptimistic` overlay written at the top of the action — visible
835
+ * immediately, dropped automatically when the transition settles. The
836
+ * engine's revert-on-settle IS the submission state machine.
837
+ * - `options.onMutate(variables)` runs inside the same window: it is the
838
+ * place to apply the caller's own optimistic overlays
839
+ * (`createOptimistic` / `createOptimisticStore` writes). No context
840
+ * object, no rollback plumbing — reverting is the engine's job.
841
+ * - The fetch itself goes through query-core:
842
+ * `mutationCache.build().execute()` supplies retry/backoff, offline
843
+ * pausing, scoped serial execution, and cache-level lifecycle callbacks.
844
+ * No `MutationObserver` — the adapter reads the Mutation's state
845
+ * directly where flight metadata (failureCount, isPaused) is needed.
846
+ * - Options-level callbacks are stripped from the built mutation and
847
+ * re-run *post-`yield`*, inside the transaction: an
848
+ * `onSuccess → invalidateQueries` chain issues version bumps whose
849
+ * refetches hold this very transition, so mutation success and fresh
850
+ * query data land in one atomic paint (and a single-flight payload has
851
+ * already primed the cache by the time `execute` resolves).
852
+ * - One `mutate`, returning a safe-to-ignore promise: rejection is also
853
+ * routed into reactive state, and a no-op catch keeps the ignored
854
+ * branch from surfacing as an unhandled rejection. The
855
+ * `mutate`/`mutateAsync` split existed for React's callback-vs-promise
856
+ * error routing; it has no space here.
857
+ */
802
858
  declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, queryClient?: Accessor<QueryClient>): UseMutationResult<TData, TError, TVariables, TOnMutateResult>;
803
859
  export { useMutation }
804
860
  export { useMutation as useMutation_alias_1 }
805
861
 
806
862
  declare type UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = Accessor<MutationOptions<TData, TError, TVariables, TOnMutateResult>>;
807
- export { UseMutationOptions as CreateMutationOptions }
808
863
  export { UseMutationOptions }
809
864
  export { UseMutationOptions as UseMutationOptions_alias_1 }
810
865
 
811
866
  declare type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>;
812
- export { UseMutationResult as CreateMutationResult }
813
867
  export { UseMutationResult }
814
868
  export { UseMutationResult as UseMutationResult_alias_1 }
815
869
 
816
870
  declare function useMutationState<TResult = MutationState>(options?: Accessor<MutationStateOptions<TResult>>, queryClient?: Accessor<QueryClient>): Accessor<Array<TResult>>;
817
- export { useMutationState as createMutationState }
818
871
  export { useMutationState }
819
872
  export { useMutationState as useMutationState_alias_1 }
820
873
 
821
- declare function useQueries<T extends Array<any>, TCombinedResult extends QueriesResults<T> = QueriesResults<T>>(queriesOptions: Accessor<{
874
+ declare function useQueries<T extends Array<any>, TCombinedResult = QueriesResults<T>>(queriesOptions: Accessor<{
822
875
  queries: readonly [...QueriesOptions<T>] | readonly [...{
823
876
  [K in keyof T]: GetOptions<T[K]>;
824
877
  }];
@@ -838,23 +891,21 @@ export { useQueryClient }
838
891
  export { useQueryClient as useQueryClient_alias_1 }
839
892
 
840
893
  declare type UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Accessor<QueryOptions<TQueryFnData, TError, TData, TQueryKey>>;
841
- export { UseQueryOptions as CreateQueryOptions }
842
894
  export { UseQueryOptions }
843
895
  export { UseQueryOptions as UseQueryOptions_alias_1 }
844
896
 
845
- declare type UseQueryOptionsForUseQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<QueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData' | 'suspense'> & {
897
+ declare type UseQueryOptionsForUseQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<QueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData'> & {
846
898
  placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>;
847
899
  /**
848
- * @deprecated The `suspense` option has been deprecated in v5 and will be removed in the next major version.
849
- * The `data` property on useQueries is a plain object and not a SolidJS Resource.
850
- * It will not suspend when the data is loading.
851
- * Setting `suspense` to `true` will be a no-op.
900
+ * @deprecated The `suspense` option has been removed. Suspense is the
901
+ * model: each result's `data` is an async read that suspends into the
902
+ * nearest `<Loading>` boundary while its first fetch is in flight, same
903
+ * as `useQuery`. Setting `suspense` is a no-op.
852
904
  */
853
905
  suspense?: boolean;
854
906
  };
855
907
 
856
908
  declare type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
857
- export { UseQueryResult as CreateQueryResult }
858
909
  export { UseQueryResult }
859
910
  export { UseQueryResult as UseQueryResult_alias_1 }
860
911