@tanstack/solid-query 5.103.1 → 5.103.3

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
@@ -22,8 +22,8 @@ Hooks for fetching, caching and updating asynchronous data in Solid
22
22
  <img alt="#TanStack" src="https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack">
23
23
  </a><a href="https://discord.com/invite/WrRKjPJ" target="\_parent">
24
24
  <img alt="" src="https://img.shields.io/badge/Discord-TanStack-%235865F2" />
25
- </a><a href="https://github.com/TanStack/query/actions?query=workflow%3A%ci%22">
26
- <img src="https://github.com/TanStack/query/workflows/ci/badge.svg" />
25
+ </a><a href="https://github.com/TanStack/query/actions/workflows/release.yml?query=branch%3Amain">
26
+ <img alt="Release status" src="https://github.com/TanStack/query/actions/workflows/release.yml/badge.svg?branch=main" />
27
27
  </a><a href="https://www.npmjs.com/package/@tanstack/query-core" target="\_parent">
28
28
  <img alt="" src="https://img.shields.io/npm/dm/@tanstack/query-core.svg" />
29
29
  </a><a href="https://bundlejs.com/?q=%40tanstack%2Fsolid-query&config=%7B%22esbuild%22%3A%7B%22external%22%3A%5B%22solid-js%22%2C%5D%7D%7D&badge=" target="\_parent">
package/build/dev.cjs CHANGED
@@ -10,7 +10,7 @@ let solid_js_store = require("solid-js/store");
10
10
  const QueryClientContext = (0, solid_js.createContext)(void 0);
11
11
  const queryClientContextError = "No QueryClient set, use QueryClientProvider to set one";
12
12
  /**
13
- * The `useQueryClient` hook returns the current `QueryClient` instance.
13
+ * The `useQueryClient` primitive returns the current `QueryClient` instance.
14
14
  *
15
15
  * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
16
16
  * be used.
@@ -69,7 +69,7 @@ const QueryClientProvider = (props) => {
69
69
  //#region src/isRestoring.ts
70
70
  const IsRestoringContext = (0, solid_js.createContext)(() => false);
71
71
  /**
72
- * If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` hook alongside it to
72
+ * If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` primitive alongside it to
73
73
  * check if a restore is currently in progress. `useQuery` and friends also check this internally to avoid
74
74
  * race conditions between the restore and mounting queries.
75
75
  *
@@ -251,7 +251,7 @@ function useBaseQuery(options, Observer, queryClient) {
251
251
  if (!restoring && !solid_js_web.isServer) refetch();
252
252
  }, { defer: true }));
253
253
  (0, solid_js.onCleanup)(() => {
254
- if (solid_js_web.isServer && queryResource.loading) {
254
+ if (solid_js_web.isServer && queryResource.state === "pending") {
255
255
  unsubscribeQueued = true;
256
256
  return;
257
257
  }
@@ -290,6 +290,9 @@ function useInfiniteQuery(options, queryClient) {
290
290
  //#endregion
291
291
  //#region src/useMutation.ts
292
292
  /**
293
+ * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
294
+ * `useMutation` is the primitive for that.
295
+ *
293
296
  * @param options - An accessor returning the {@link UseMutationOptions} to use.
294
297
  * @param queryClient - An accessor for a custom `QueryClient`. Otherwise, the one from the nearest context
295
298
  * will be used.
@@ -479,7 +482,7 @@ function useMutation(options, queryClient) {
479
482
  //#endregion
480
483
  //#region src/useQueries.ts
481
484
  /**
482
- * The `useQueries` hook can be used to fetch a variable number of queries.
485
+ * The `useQueries` primitive can be used to fetch a variable number of queries.
483
486
  *
484
487
  * The `queries` key accepts an array with query option objects mostly identical to `useQuery` — see
485
488
  * `placeholderData` below for the one difference. A custom `QueryClient` is supplied once, as `useQueries`'
@@ -653,7 +656,7 @@ function queryOptions(options) {
653
656
  //#endregion
654
657
  //#region src/useIsFetching.ts
655
658
  /**
656
- * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching
659
+ * The `useIsFetching` primitive returns the `number` of the queries that your application is loading or fetching
657
660
  * in the background (useful for app-wide loading indicators).
658
661
  *
659
662
  * @param filters - An accessor returning the {@link QueryFilters} to narrow down the matched queries.
@@ -701,7 +704,7 @@ function mutationOptions(options) {
701
704
  //#endregion
702
705
  //#region src/useIsMutating.ts
703
706
  /**
704
- * The `useIsMutating` hook returns the `number` of mutations that your application currently has `pending`
707
+ * The `useIsMutating` primitive returns the `number` of mutations that your application currently has `pending`
705
708
  * (useful for app-wide loading indicators).
706
709
  *
707
710
  * @param filters - An accessor returning the {@link MutationFilters} to narrow down the matched mutations.
@@ -741,7 +744,7 @@ function getResult(mutationCache, options) {
741
744
  return mutationCache.findAll(options.filters).map((mutation) => options.select ? options.select(mutation) : mutation.state);
742
745
  }
743
746
  /**
744
- * `useMutationState` is a hook that gives you access to all mutations in the `MutationCache`. You can pass
747
+ * `useMutationState` is a primitive that gives you access to all mutations in the `MutationCache`. You can pass
745
748
  * `filters` ({@link MutationFilters}) to narrow down your mutations, and `select` to transform the mutation
746
749
  * state.
747
750
  *
package/build/dev.js CHANGED
@@ -10,7 +10,7 @@ export * from "@tanstack/query-core";
10
10
  const QueryClientContext = createContext(void 0);
11
11
  const queryClientContextError = "No QueryClient set, use QueryClientProvider to set one";
12
12
  /**
13
- * The `useQueryClient` hook returns the current `QueryClient` instance.
13
+ * The `useQueryClient` primitive returns the current `QueryClient` instance.
14
14
  *
15
15
  * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
16
16
  * be used.
@@ -69,7 +69,7 @@ const QueryClientProvider = (props) => {
69
69
  //#region src/isRestoring.ts
70
70
  const IsRestoringContext = createContext(() => false);
71
71
  /**
72
- * If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` hook alongside it to
72
+ * If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` primitive alongside it to
73
73
  * check if a restore is currently in progress. `useQuery` and friends also check this internally to avoid
74
74
  * race conditions between the restore and mounting queries.
75
75
  *
@@ -251,7 +251,7 @@ function useBaseQuery(options, Observer, queryClient) {
251
251
  if (!restoring && !isServer) refetch();
252
252
  }, { defer: true }));
253
253
  onCleanup(() => {
254
- if (isServer && queryResource.loading) {
254
+ if (isServer && queryResource.state === "pending") {
255
255
  unsubscribeQueued = true;
256
256
  return;
257
257
  }
@@ -290,6 +290,9 @@ function useInfiniteQuery(options, queryClient) {
290
290
  //#endregion
291
291
  //#region src/useMutation.ts
292
292
  /**
293
+ * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
294
+ * `useMutation` is the primitive for that.
295
+ *
293
296
  * @param options - An accessor returning the {@link UseMutationOptions} to use.
294
297
  * @param queryClient - An accessor for a custom `QueryClient`. Otherwise, the one from the nearest context
295
298
  * will be used.
@@ -479,7 +482,7 @@ function useMutation(options, queryClient) {
479
482
  //#endregion
480
483
  //#region src/useQueries.ts
481
484
  /**
482
- * The `useQueries` hook can be used to fetch a variable number of queries.
485
+ * The `useQueries` primitive can be used to fetch a variable number of queries.
483
486
  *
484
487
  * The `queries` key accepts an array with query option objects mostly identical to `useQuery` — see
485
488
  * `placeholderData` below for the one difference. A custom `QueryClient` is supplied once, as `useQueries`'
@@ -653,7 +656,7 @@ function queryOptions(options) {
653
656
  //#endregion
654
657
  //#region src/useIsFetching.ts
655
658
  /**
656
- * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching
659
+ * The `useIsFetching` primitive returns the `number` of the queries that your application is loading or fetching
657
660
  * in the background (useful for app-wide loading indicators).
658
661
  *
659
662
  * @param filters - An accessor returning the {@link QueryFilters} to narrow down the matched queries.
@@ -701,7 +704,7 @@ function mutationOptions(options) {
701
704
  //#endregion
702
705
  //#region src/useIsMutating.ts
703
706
  /**
704
- * The `useIsMutating` hook returns the `number` of mutations that your application currently has `pending`
707
+ * The `useIsMutating` primitive returns the `number` of mutations that your application currently has `pending`
705
708
  * (useful for app-wide loading indicators).
706
709
  *
707
710
  * @param filters - An accessor returning the {@link MutationFilters} to narrow down the matched mutations.
@@ -741,7 +744,7 @@ function getResult(mutationCache, options) {
741
744
  return mutationCache.findAll(options.filters).map((mutation) => options.select ? options.select(mutation) : mutation.state);
742
745
  }
743
746
  /**
744
- * `useMutationState` is a hook that gives you access to all mutations in the `MutationCache`. You can pass
747
+ * `useMutationState` is a primitive that gives you access to all mutations in the `MutationCache`. You can pass
745
748
  * `filters` ({@link MutationFilters}) to narrow down your mutations, and `select` to transform the mutation
746
749
  * state.
747
750
  *
package/build/index.cjs CHANGED
@@ -1 +1,3 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@tanstack/query-core"),t=require("solid-js"),n=require("solid-js/web"),r=require("solid-js/store");const i=(0,t.createContext)(void 0),a=`No QueryClient set, use QueryClientProvider to set one`,o=e=>{if(e)return e;let n=(0,t.useContext)(i);if(!n)throw Error(a);return n()},s=e=>{let n=(0,t.useContext)(i);return()=>{let t=e?.();if(t)return t;if(!n)throw Error(a);return n()}},c=e=>((0,t.createRenderEffect)(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),(0,t.onCleanup)(()=>e.client.unmount()),(0,n.createComponent)(i.Provider,{value:()=>e.client,get children(){return e.children}})),l=(0,t.createContext)(()=>!1),u=()=>(0,t.useContext)(l),d=l.Provider;function f(e,t,n,i){if(n===!1)return t;if(typeof n==`function`){let r=n(e.data,t.data);return{...t,data:r}}let a=t.data;if(e.data===void 0)try{a=structuredClone(a)}catch{}let o=(0,r.reconcile)(a,{key:n})(e.data);return{...t,data:o}}const p=(e,t)=>{if(!n.isServer)return t;let i={...(0,r.unwrap)(t),refetch:void 0};return`fetchNextPage`in t&&(i.fetchNextPage=void 0,i.fetchPreviousPage=void 0),i.hydrationData={state:e.state,queryKey:e.queryKey,queryHash:e.queryHash,...e.meta&&{meta:e.meta}},i};function m(i,a,o){let c=s(o),l=(0,t.createMemo)(()=>c()),d=u(),m=!1,h=(0,t.createMemo)(()=>{let e=l().defaultQueryOptions(i());return e._optimisticResults=d()?`isRestoring`:`optimistic`,e.structuralSharing=!1,n.isServer&&(e.retry=!1,e.throwOnError=!0),e}),g=h(),[_,v]=(0,t.createSignal)(new a(l(),h())),y=_().getOptimisticResult(h()),[b,x]=(0,r.createStore)(y),S=(t,n)=>_().subscribe(r=>{e.notifyManager.batchCalls(()=>{let e=_().getCurrentQuery(),i=p(e,r);r.data!==void 0&&i.isError?(n(i.error),C()):(t(i),C())})()}),C=()=>{m&&=(D?.(),!1)},w=()=>_().subscribe(e=>{y=e,queueMicrotask(()=>{D&&A()})});function T(e){let t=_().options,n=t.reconcile;x(r=>f(r,e,n!==void 0&&n,t.queryHash))}function E(){return[()=>b,e=>{let t=(0,r.unwrap)(b);if(typeof e==`function`&&(e=e(t)),e?.hydrationData){let{hydrationData:t,...n}=e;e=n}T(e)}]}let D=null,O=null,[k,{refetch:A}]=(0,t.createResource)(()=>{let t=_();return new Promise((r,i)=>{if(O=r,n.isServer?D=S(r,i):!D&&!d()&&(D=w()),t.updateResult(),y.isError&&!y.isFetching&&!d()&&(0,e.shouldThrowError)(t.options.throwOnError,[y.error,t.getCurrentQuery()]))return T(y),i(y.error);if(!y.isLoading)return O=null,r(p(t.getCurrentQuery(),y));T(y)})},{storage:E,get deferStream(){return i().deferStream},onHydrated(t,n){if(n.value&&`hydrationData`in n.value&&(0,e.hydrate)(l(),{queries:[{...n.value.hydrationData}]}),D)return;let r={...g};(g.staleTime||!g.initialData)&&n.value&&(r.refetchOnMount=!1),_().setOptions(r),T(_().getOptimisticResult(r)),D=w()}});return(0,t.createComputed)((0,t.on)(l,e=>{D&&D();let t=new a(e,h());D=w(),v(t)},{defer:!0})),(0,t.createComputed)((0,t.on)(d,e=>{!e&&!n.isServer&&A()},{defer:!0})),(0,t.onCleanup)(()=>{if(n.isServer&&k.loading){m=!0;return}D&&=(D(),null),O&&!n.isServer&&(O(y),O=null)}),(0,t.createComputed)((0,t.on)([_,h],([e,t])=>{e.setOptions(t),T(e.getOptimisticResult(t)),A()},{defer:!0})),new Proxy(b,{get(e,t){return t===`data`?b.data===void 0?k()?.data:k.latest?.data:Reflect.get(e,t)}})}function h(n,r){return m((0,t.createMemo)(()=>n()),e.QueryObserver,r)}function g(n,r){return m((0,t.createMemo)(()=>n()),e.InfiniteQueryObserver,r)}function _(n,i){let a=s(i),o=(0,t.createMemo)(()=>a()),c=new e.MutationObserver(o(),n()),l=(...t)=>{c.mutate(t[0],t[1]).catch(e.noop)},[u,d]=(0,r.createStore)({...c.getCurrentResult(),mutate:l,mutateAsync:c.getCurrentResult().mutate});(0,t.createComputed)(()=>{c.setOptions(n())}),(0,t.createComputed)((0,t.on)(()=>u.status,()=>{if(u.isError&&(0,e.shouldThrowError)(c.options.throwOnError,[u.error]))throw u.error}));let f=c.subscribe(e=>{d({...e,mutate:l,mutateAsync:e.mutate})});return(0,t.onCleanup)(f),u}function v(n,i){let a=s(i),o=(0,t.createMemo)(()=>a()),c=u(),l=(0,t.createMemo)(()=>n().queries.map(e=>(0,t.mergeProps)(o().defaultQueryOptions(e),{get _optimisticResults(){return c()?`isRestoring`:`optimistic`}}))),d=new e.QueriesObserver(o(),l(),n().combine?{combine:n().combine}:void 0),[f,p]=(0,r.createStore)(d.getOptimisticResult(l(),n().combine)[1]());(0,t.createRenderEffect)((0,t.on)(()=>n().queries.length,()=>p(d.getOptimisticResult(l(),n().combine)[1]())));let m=(0,t.createMemo)((0,t.on)(()=>f.length,()=>f.map(e=>(0,t.createResource)(()=>new Promise(t=>{e.isFetching&&e.isLoading||t((0,r.unwrap)(e.data))})))));(0,t.batch)(()=>{let e=m();for(let t=0;t<e.length;t++){let n=e[t];n[1].mutate(()=>(0,r.unwrap)(f[t].data)),n[1].refetch()}});let h=[],g=()=>d.subscribe(e=>{h.push(()=>{(0,t.batch)(()=>{let t=m();for(let n=0;n<t.length;n++){let i=t[n],a={...(0,r.unwrap)(e[n])};p(n,(0,r.unwrap)(a)),i[1].mutate(()=>(0,r.unwrap)(f[n].data)),i[1].refetch()}})}),queueMicrotask(()=>{let e=h.pop();e&&e(),h=[]})}),_=e.noop;(0,t.createComputed)(t=>(t?.(),_=c()?e.noop:g(),()=>queueMicrotask(_))),(0,t.onCleanup)(_),(0,t.onMount)(()=>{d.setQueries(l(),n().combine?{combine:n().combine}:void 0)}),(0,t.createComputed)(()=>{d.setQueries(l(),n().combine?{combine:n().combine}:void 0)});let v=e=>({get(t,n){return n===`data`?m()[e][0]():Reflect.get(t,n)}}),y=()=>f.map((e,t)=>new Proxy(e,v(t))),[b,x]=(0,r.createStore)(y());return(0,t.createRenderEffect)(()=>x(y())),b}var y=class extends e.QueryClient{constructor(e={}){super(e)}};function b(e){return e}function x(e,n){let r=s(n),i=(0,t.createMemo)(()=>r()),a=(0,t.createMemo)(()=>i().getQueryCache()),[o,c]=(0,t.createSignal)(i().isFetching(e?.()));return(0,t.createEffect)(()=>{c(i().isFetching(e?.()));let n=a().subscribe(()=>{c(i().isFetching(e?.()))});(0,t.onCleanup)(n)}),o}function S(e){return e}function C(e){return e}function w(e,n){let r=s(n),i=(0,t.createMemo)(()=>r()),a=(0,t.createMemo)(()=>i().getMutationCache()),[o,c]=(0,t.createSignal)(i().isMutating(e?.()));return(0,t.createEffect)(()=>{c(i().isMutating(e?.()));let n=a().subscribe(()=>{c(i().isMutating(e?.()))});(0,t.onCleanup)(n)}),o}function T(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function E(n=()=>({}),r){let i=s(r),a=(0,t.createMemo)(()=>i()),o=(0,t.createMemo)(()=>a().getMutationCache()),[c,l]=(0,t.createSignal)(T(o(),n()));return(0,t.createEffect)(()=>{let r=o().subscribe(()=>{let t=(0,e.replaceEqualDeep)(c(),T(o(),n()));c()!==t&&l(t)});(0,t.onCleanup)(r)}),c}const D=h,O=g,k=_,A=v;exports.IsRestoringProvider=d,exports.QueryClient=y,exports.QueryClientContext=i,exports.QueryClientProvider=c,exports.createInfiniteQuery=O,exports.createIsFetching=x,exports.useIsFetching=x,exports.createIsMutating=w,exports.useIsMutating=w,exports.createMutation=k,exports.createMutationState=E,exports.useMutationState=E,exports.createQueries=A,exports.createQuery=D,exports.infiniteQueryOptions=S,exports.mutationOptions=C,exports.queryOptions=b,exports.useInfiniteQuery=g,exports.useIsRestoring=u,exports.useMutation=_,exports.useQueries=v,exports.useQuery=h,exports.useQueryClient=o,Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@tanstack/query-core"),t=require("solid-js"),n=require("solid-js/web"),r=require("solid-js/store");const i=(0,t.createContext)(void 0),a=`No QueryClient set, use QueryClientProvider to set one`,o=e=>{if(e)return e;let n=(0,t.useContext)(i);if(!n)throw Error(a);return n()},s=e=>{let n=(0,t.useContext)(i);return()=>{let t=e?.();if(t)return t;if(!n)throw Error(a);return n()}},c=e=>((0,t.createRenderEffect)(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),(0,t.onCleanup)(()=>e.client.unmount()),(0,n.createComponent)(i.Provider,{value:()=>e.client,get children(){return e.children}})),l=(0,t.createContext)(()=>!1),u=()=>(0,t.useContext)(l),d=l.Provider;function f(e,t,n,i){if(n===!1)return t;if(typeof n==`function`){let r=n(e.data,t.data);return{...t,data:r}}let a=t.data;if(e.data===void 0)try{a=structuredClone(a)}catch{}let o=(0,r.reconcile)(a,{key:n})(e.data);return{...t,data:o}}const p=(e,t)=>{if(!n.isServer)return t;let i={...(0,r.unwrap)(t),refetch:void 0};return`fetchNextPage`in t&&(i.fetchNextPage=void 0,i.fetchPreviousPage=void 0),i.hydrationData={state:e.state,queryKey:e.queryKey,queryHash:e.queryHash,...e.meta&&{meta:e.meta}},i};function m(i,a,o){let c=s(o),l=(0,t.createMemo)(()=>c()),d=u(),m=!1,h=(0,t.createMemo)(()=>{let e=l().defaultQueryOptions(i());return e._optimisticResults=d()?`isRestoring`:`optimistic`,e.structuralSharing=!1,n.isServer&&(e.retry=!1,e.throwOnError=!0),e}),g=h(),[_,v]=(0,t.createSignal)(new a(l(),h())),y=_().getOptimisticResult(h()),[b,x]=(0,r.createStore)(y),S=(t,n)=>_().subscribe(r=>{e.notifyManager.batchCalls(()=>{let e=_().getCurrentQuery(),i=p(e,r);r.data!==void 0&&i.isError?(n(i.error),C()):(t(i),C())})()}),C=()=>{m&&=(D?.(),!1)},w=()=>_().subscribe(e=>{y=e,queueMicrotask(()=>{D&&A()})});function T(e){let t=_().options,n=t.reconcile;x(r=>f(r,e,n!==void 0&&n,t.queryHash))}function E(){return[()=>b,e=>{let t=(0,r.unwrap)(b);if(typeof e==`function`&&(e=e(t)),e?.hydrationData){let{hydrationData:t,...n}=e;e=n}T(e)}]}let D=null,O=null,[k,{refetch:A}]=(0,t.createResource)(()=>{let t=_();return new Promise((r,i)=>{if(O=r,n.isServer?D=S(r,i):!D&&!d()&&(D=w()),t.updateResult(),y.isError&&!y.isFetching&&!d()&&(0,e.shouldThrowError)(t.options.throwOnError,[y.error,t.getCurrentQuery()]))return T(y),i(y.error);if(!y.isLoading)return O=null,r(p(t.getCurrentQuery(),y));T(y)})},{storage:E,get deferStream(){return i().deferStream},onHydrated(t,n){if(n.value&&`hydrationData`in n.value&&(0,e.hydrate)(l(),{queries:[{...n.value.hydrationData}]}),D)return;let r={...g};(g.staleTime||!g.initialData)&&n.value&&(r.refetchOnMount=!1),_().setOptions(r),T(_().getOptimisticResult(r)),D=w()}});return(0,t.createComputed)((0,t.on)(l,e=>{D&&D();let t=new a(e,h());D=w(),v(t)},{defer:!0})),(0,t.createComputed)((0,t.on)(d,e=>{!e&&!n.isServer&&A()},{defer:!0})),(0,t.onCleanup)(()=>{if(n.isServer&&k.state===`pending`){m=!0;return}D&&=(D(),null),O&&!n.isServer&&(O(y),O=null)}),(0,t.createComputed)((0,t.on)([_,h],([e,t])=>{e.setOptions(t),T(e.getOptimisticResult(t)),A()},{defer:!0})),new Proxy(b,{get(e,t){return t===`data`?b.data===void 0?k()?.data:k.latest?.data:Reflect.get(e,t)}})}function h(n,r){return m((0,t.createMemo)(()=>n()),e.QueryObserver,r)}function g(n,r){return m((0,t.createMemo)(()=>n()),e.InfiniteQueryObserver,r)}function _(n,i){let a=s(i),o=(0,t.createMemo)(()=>a()),c=new e.MutationObserver(o(),n()),l=(...t)=>{c.mutate(t[0],t[1]).catch(e.noop)},[u,d]=(0,r.createStore)({...c.getCurrentResult(),mutate:l,mutateAsync:c.getCurrentResult().mutate});(0,t.createComputed)(()=>{c.setOptions(n())}),(0,t.createComputed)((0,t.on)(()=>u.status,()=>{if(u.isError&&(0,e.shouldThrowError)(c.options.throwOnError,[u.error]))throw u.error}));let f=c.subscribe(e=>{d({...e,mutate:l,mutateAsync:e.mutate})});return(0,t.onCleanup)(f),u}function v(n,i){let a=s(i),o=(0,t.createMemo)(()=>a()),c=u(),l=(0,t.createMemo)(()=>n().queries.map(e=>(0,t.mergeProps)(o().defaultQueryOptions(e),{get _optimisticResults(){return c()?`isRestoring`:`optimistic`}}))),d=new e.QueriesObserver(o(),l(),n().combine?{combine:n().combine}:void 0),[f,p]=(0,r.createStore)(d.getOptimisticResult(l(),n().combine)[1]());(0,t.createRenderEffect)((0,t.on)(()=>n().queries.length,()=>p(d.getOptimisticResult(l(),n().combine)[1]())));let m=(0,t.createMemo)((0,t.on)(()=>f.length,()=>f.map(e=>(0,t.createResource)(()=>new Promise(t=>{e.isFetching&&e.isLoading||t((0,r.unwrap)(e.data))})))));(0,t.batch)(()=>{let e=m();for(let t=0;t<e.length;t++){let n=e[t];n[1].mutate(()=>(0,r.unwrap)(f[t].data)),n[1].refetch()}});let h=[],g=()=>d.subscribe(e=>{h.push(()=>{(0,t.batch)(()=>{let t=m();for(let n=0;n<t.length;n++){let i=t[n],a={...(0,r.unwrap)(e[n])};p(n,(0,r.unwrap)(a)),i[1].mutate(()=>(0,r.unwrap)(f[n].data)),i[1].refetch()}})}),queueMicrotask(()=>{let e=h.pop();e&&e(),h=[]})}),_=e.noop;(0,t.createComputed)(t=>(t?.(),_=c()?e.noop:g(),()=>queueMicrotask(_))),(0,t.onCleanup)(_),(0,t.onMount)(()=>{d.setQueries(l(),n().combine?{combine:n().combine}:void 0)}),(0,t.createComputed)(()=>{d.setQueries(l(),n().combine?{combine:n().combine}:void 0)});let v=e=>({get(t,n){return n===`data`?m()[e][0]():Reflect.get(t,n)}}),y=()=>f.map((e,t)=>new Proxy(e,v(t))),[b,x]=(0,r.createStore)(y());return(0,t.createRenderEffect)(()=>x(y())),b}var y=class extends e.QueryClient{constructor(e={}){super(e)}};function b(e){return e}function x(e,n){let r=s(n),i=(0,t.createMemo)(()=>r()),a=(0,t.createMemo)(()=>i().getQueryCache()),[o,c]=(0,t.createSignal)(i().isFetching(e?.()));return(0,t.createEffect)(()=>{c(i().isFetching(e?.()));let n=a().subscribe(()=>{c(i().isFetching(e?.()))});(0,t.onCleanup)(n)}),o}function S(e){return e}function C(e){return e}function w(e,n){let r=s(n),i=(0,t.createMemo)(()=>r()),a=(0,t.createMemo)(()=>i().getMutationCache()),[o,c]=(0,t.createSignal)(i().isMutating(e?.()));return(0,t.createEffect)(()=>{c(i().isMutating(e?.()));let n=a().subscribe(()=>{c(i().isMutating(e?.()))});(0,t.onCleanup)(n)}),o}function T(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function E(n=()=>({}),r){let i=s(r),a=(0,t.createMemo)(()=>i()),o=(0,t.createMemo)(()=>a().getMutationCache()),[c,l]=(0,t.createSignal)(T(o(),n()));return(0,t.createEffect)(()=>{let r=o().subscribe(()=>{let t=(0,e.replaceEqualDeep)(c(),T(o(),n()));c()!==t&&l(t)});(0,t.onCleanup)(r)}),c}
2
+ /* istanbul ignore file */
3
+ const D=h,O=g,k=_,A=v;exports.IsRestoringProvider=d,exports.QueryClient=y,exports.QueryClientContext=i,exports.QueryClientProvider=c,exports.createInfiniteQuery=O,exports.createIsFetching=x,exports.useIsFetching=x,exports.createIsMutating=w,exports.useIsMutating=w,exports.createMutation=k,exports.createMutationState=E,exports.useMutationState=E,exports.createQueries=A,exports.createQuery=D,exports.infiniteQueryOptions=S,exports.mutationOptions=C,exports.queryOptions=b,exports.useInfiniteQuery=g,exports.useIsRestoring=u,exports.useMutation=_,exports.useQueries=v,exports.useQuery=h,exports.useQueryClient=o,Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
package/build/index.d.cts CHANGED
@@ -81,7 +81,8 @@ interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
81
81
  * Only applicable while rendering queries on the server with streaming.
82
82
  * Set `deferStream` to `true` to wait for the query to resolve on the server before flushing the stream.
83
83
  * This can be useful to avoid sending a loading state to the client before the query has resolved.
84
- * Defaults to `false`.
84
+ *
85
+ * @defaultValue false
85
86
  */
86
87
  deferStream?: boolean;
87
88
  /**
@@ -130,14 +131,16 @@ type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverR
130
131
  */
131
132
  type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
132
133
  /**
133
- * The object `useQuery` returns when `initialData` guarantees `data` is never `undefined`.
134
+ * The object `useQuery` returns when `initialData` guarantees `data` is never `undefined` (unless a
135
+ * `select` changes `TData` to include `undefined`).
134
136
  *
135
137
  * @template TData - The type `data` ends up as, after `select` runs (if set).
136
138
  * @template TError - The type of errors this query may hold.
137
139
  */
138
140
  type DefinedUseBaseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
139
141
  /**
140
- * The object `useQuery` returns when `initialData` guarantees `data` is never `undefined`.
142
+ * The object `useQuery` returns when `initialData` guarantees `data` is never `undefined` (unless a
143
+ * `select` changes `TData` to include `undefined`).
141
144
  *
142
145
  * @template TData - The type `data` ends up as, after `select` runs (if set).
143
146
  * @template TError - The type of errors this query may hold.
@@ -153,12 +156,21 @@ type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedUseB
153
156
  * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
154
157
  */
155
158
  interface InfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryKey' | 'suspense'> {
159
+ /**
160
+ * The query key to use for this query. Required here, unlike on the options this type extends.
161
+ *
162
+ * The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/solid/guides/query-keys)
163
+ * for more information.
164
+ *
165
+ * The query will automatically update when this key changes (as long as `enabled` is not set to `false`).
166
+ */
156
167
  queryKey: TQueryKey;
157
168
  /**
158
169
  * Only applicable while rendering queries on the server with streaming.
159
170
  * Set `deferStream` to `true` to wait for the query to resolve on the server before flushing the stream.
160
171
  * This can be useful to avoid sending a loading state to the client before the query has resolved.
161
- * Defaults to `false`.
172
+ *
173
+ * @defaultValue false
162
174
  */
163
175
  deferStream?: boolean;
164
176
  /**
@@ -188,7 +200,8 @@ type UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TDat
188
200
  */
189
201
  type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
190
202
  /**
191
- * The object `useInfiniteQuery` returns when `initialData` guarantees `data` is never `undefined`.
203
+ * The object `useInfiniteQuery` returns when `initialData` guarantees `data` is never `undefined` (unless a
204
+ * `select` changes `TData` to include `undefined`).
192
205
  *
193
206
  * @template TData - The type `data` ends up as, after `select` runs (if set).
194
207
  * @template TError - The type of errors this query may hold.
@@ -271,7 +284,7 @@ type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError,
271
284
  }>;
272
285
  /**
273
286
  * The options accepted by the `queryOptions` overload selected when `initialData` is set — `data` is never
274
- * `undefined`.
287
+ * `undefined` (unless a `select` changes `TData` to include `undefined`).
275
288
  *
276
289
  * @template TQueryFnData - The type your `queryFn` resolves to.
277
290
  * @template TError - The type of errors your `queryFn` may throw.
@@ -286,7 +299,8 @@ type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TD
286
299
  * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and
287
300
  * is the query key to generate options for.
288
301
  *
289
- * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`.
302
+ * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless
303
+ * a `select` changes `TData` to include `undefined`).
290
304
  *
291
305
  * @see {@link useQuery} to run a query with these options.
292
306
  * @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, with `initialData` set.
@@ -360,6 +374,9 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
360
374
  //#endregion
361
375
  //#region src/useQuery.d.ts
362
376
  /**
377
+ * Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
378
+ * The query runs when the options call for it — `enabled: false` skips the initial fetch.
379
+ *
363
380
  * @see {@link queryOptions} to share these options between `useQuery` and imperative APIs like `queryClient.query`.
364
381
  * @param options - An accessor returning the {@link UndefinedInitialDataOptions} to use — everything you can
365
382
  * pass to `useQuery`.
@@ -469,7 +486,9 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
469
486
  * ```
470
487
  *
471
488
  * @example
472
- * Seeding a detail query from an already-cached list, to skip the loading state:
489
+ * Seeding a detail query from an already-cached list, to skip the loading state. `initialDataUpdatedAt` carries
490
+ * over the list's own fetch time, so that if you set a `staleTime`, it's measured from when the list was
491
+ * fetched rather than from now:
473
492
  * ```tsx
474
493
  * import { useQuery, useQueryClient } from '@tanstack/solid-query'
475
494
  *
@@ -483,6 +502,8 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
483
502
  * queryClient
484
503
  * .getQueryData<Array<Post>>(['posts'])
485
504
  * ?.find((post) => post.id === props.postId),
505
+ * initialDataUpdatedAt: () =>
506
+ * queryClient.getQueryState(['posts'])?.dataUpdatedAt,
486
507
  * }))
487
508
  *
488
509
  * return postQuery.isError ? <span>Error: {postQuery.error.message}</span> : <h1>{postQuery.data?.title}</h1>
@@ -522,7 +543,11 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
522
543
  */
523
544
  declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: () => QueryClient): UseQueryResult<TData, TError>;
524
545
  /**
525
- * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`.
546
+ * Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
547
+ * The query runs when the options call for it — `enabled: false` skips the initial fetch.
548
+ *
549
+ * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless
550
+ * a `select` changes `TData` to include `undefined`).
526
551
  *
527
552
  * @see {@link queryOptions} to share these options between `useQuery` and imperative APIs like `queryClient.query`.
528
553
  * @param options - An accessor returning the {@link DefinedInitialDataOptions} to use — everything you can
@@ -581,7 +606,7 @@ type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TD
581
606
  }>;
582
607
  /**
583
608
  * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is
584
- * never `undefined`.
609
+ * never `undefined` (unless a `select` changes `TData` to include `undefined`).
585
610
  *
586
611
  * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
587
612
  * @template TError - The type of errors your `queryFn` may throw.
@@ -836,6 +861,9 @@ declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = I
836
861
  //#endregion
837
862
  //#region src/useMutation.d.ts
838
863
  /**
864
+ * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
865
+ * `useMutation` is the primitive for that.
866
+ *
839
867
  * @param options - An accessor returning the {@link UseMutationOptions} to use.
840
868
  * @param queryClient - An accessor for a custom `QueryClient`. Otherwise, the one from the nearest context
841
869
  * will be used.
@@ -1048,7 +1076,7 @@ type QueriesOptions<T extends Array<any>, TResult extends Array<any> = [], TDept
1048
1076
  */
1049
1077
  type QueriesResults<T extends Array<any>, TResult extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResult, GetResults<Head>] : T extends [infer Head, ...infer Tail] ? QueriesResults<[...Tail], [...TResult, GetResults<Head>], [...TDepth, 1]> : { [K in keyof T]: GetResults<T[K]>; };
1050
1078
  /**
1051
- * The `useQueries` hook can be used to fetch a variable number of queries.
1079
+ * The `useQueries` primitive can be used to fetch a variable number of queries.
1052
1080
  *
1053
1081
  * The `queries` key accepts an array with query option objects mostly identical to `useQuery` — see
1054
1082
  * `placeholderData` below for the one difference. A custom `QueryClient` is supplied once, as `useQueries`'
@@ -1145,7 +1173,7 @@ declare function useQueries<T extends Array<any>, TCombinedResult extends Querie
1145
1173
  */
1146
1174
  declare const QueryClientContext: import("solid-js").Context<(() => QueryClient) | undefined>;
1147
1175
  /**
1148
- * The `useQueryClient` hook returns the current `QueryClient` instance.
1176
+ * The `useQueryClient` primitive returns the current `QueryClient` instance.
1149
1177
  *
1150
1178
  * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
1151
1179
  * be used.
@@ -1191,7 +1219,7 @@ declare const QueryClientProvider: (props: QueryClientProviderProps) => JSX.Elem
1191
1219
  //#endregion
1192
1220
  //#region src/useIsFetching.d.ts
1193
1221
  /**
1194
- * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching
1222
+ * The `useIsFetching` primitive returns the `number` of the queries that your application is loading or fetching
1195
1223
  * in the background (useful for app-wide loading indicators).
1196
1224
  *
1197
1225
  * @param filters - An accessor returning the {@link QueryFilters} to narrow down the matched queries.
@@ -1275,7 +1303,7 @@ declare function mutationOptions<TData = unknown, TError = DefaultError, TVariab
1275
1303
  //#endregion
1276
1304
  //#region src/useIsMutating.d.ts
1277
1305
  /**
1278
- * The `useIsMutating` hook returns the `number` of mutations that your application currently has `pending`
1306
+ * The `useIsMutating` primitive returns the `number` of mutations that your application currently has `pending`
1279
1307
  * (useful for app-wide loading indicators).
1280
1308
  *
1281
1309
  * @param filters - An accessor returning the {@link MutationFilters} to narrow down the matched mutations.
@@ -1304,7 +1332,7 @@ type MutationStateOptions<TResult = MutationState, TMutation extends Mutation<an
1304
1332
  select?: (mutation: TMutation) => TResult;
1305
1333
  };
1306
1334
  /**
1307
- * `useMutationState` is a hook that gives you access to all mutations in the `MutationCache`. You can pass
1335
+ * `useMutationState` is a primitive that gives you access to all mutations in the `MutationCache`. You can pass
1308
1336
  * `filters` ({@link MutationFilters}) to narrow down your mutations, and `select` to transform the mutation
1309
1337
  * state.
1310
1338
  *
@@ -1380,7 +1408,7 @@ declare function useMutationState<TResult = MutationState, TMutation extends Mut
1380
1408
  //#endregion
1381
1409
  //#region src/isRestoring.d.ts
1382
1410
  /**
1383
- * If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` hook alongside it to
1411
+ * If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` primitive alongside it to
1384
1412
  * check if a restore is currently in progress. `useQuery` and friends also check this internally to avoid
1385
1413
  * race conditions between the restore and mounting queries.
1386
1414
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/QueryClient.ts","../src/types.ts","../src/queryOptions.ts","../src/useQuery.ts","../src/infiniteQueryOptions.ts","../src/useInfiniteQuery.ts","../src/useMutation.ts","../src/useQueries.ts","../src/QueryClientProvider.tsx","../src/useIsFetching.ts","../src/mutationOptions.ts","../src/useIsMutating.ts","../src/useMutationState.ts","../src/isRestoring.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;UAsBiB,qBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,UAC7B,4BACQ,UACR,uBACE,cACA,QACA,OACA,YACA,WACA;;;;;;;EAUF,+BAGM,SAAS,mBAAmB,SAAS,UAAU;;;;;;;;;;;UAYtC,6BACf,wBACA,SAAS,cACT,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;;;;;;;;;cCtHL,sBAAc;;;;;cAMd,wCAAmB,yBAAA;;;cCsCnB,oBAAW;cAeX,4BAAmB;cAQnB,uBAAc;cAMd,sBAAa"}
1
+ {"version":3,"file":"index.d.cts","names":["QueryCoreObserverOptions","QueryCoreInfiniteQueryObserverOptions","CoreDefaultOptions","QueryCoreClientConfig","QueryCoreClient"],"sources":["../src/QueryClient.ts","../src/types.ts","../src/queryOptions.ts","../src/useQuery.ts","../src/infiniteQueryOptions.ts","../src/useInfiniteQuery.ts","../src/useMutation.ts","../src/useQueries.ts","../src/QueryClientProvider.tsx","../src/useIsFetching.ts","../src/mutationOptions.ts","../src/useIsMutating.ts","../src/useMutationState.ts","../src/isRestoring.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;UAsBiB,qBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,UAC7B,4BACQ,UACRA,uBACE,cACA,QACA,OACA,YACA,WACA;;;;;;;EAUF,+BACqB,SAAS,mBAAmB,SAAS,UAAU;;;;;;;;;;;UAYrD,6BACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAC7B,8BACQ,UACRC,+BACE,cACA,QACA,OACA,WACA;;;;;;;EAUF,+BACqB,SAAS,mBAAmB,SAAS,UAAU;;;;;;;;UASrD,eACf,SAAS,sBACDC,iBAAmB;EAC3B,UAAU,UAAU,8BAA8B;;;;;UAMnC,0BAA0BC;EACzC,iBAAiB;;;;;;cAON,oBAAoBC;EACnB,YAAA,SAAQ;;;;;;;;;;;;;;;;UC5EL,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,UACR,qBAAqB,cAAc,QAAQ,OAAO,YAAY;;;;;;;;EAU9D;;;;;;EAMA;;;;;;;;;;;UAYe,aACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,oBACR,cACA,QACA,OACA,cACA;;;;;;;;;;;KAaU,gBACV,w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AS,cACT,mBACA,2BAEA,SAAS,aACP,gBAAgB,OAAO,QAAQ,YAAY,mCAG5C,aACD,gBAAgB,OAAO,QAAQ,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6B7B,gBACd,iBACA,SAAS,cACT,mBACA,2BAEA,SAAS,KACP,gBAAgB,OAAO,QAAQ,YAAY,mCAG5C,KACD,gBAAgB,OAAO,QAAQ,YAAY;;;;;;;;;;;;;;;;;;;;;;;;iBCxD7B,cACd,UAAU,SAAS,kBACnB,cAAc,SAAS,eACtB;;;KClBE,uBAAuB,YAAY,kBACtC,oBACQ,aACA,cACA,kBACA,oBAGN,SAAS,OAAO,QAAQ,YAAY,mBACpC;KAEC,qBACH,UAAU,eACV,kBAAkB,+BAChB,uBAAuB;EAEzB,UAAU;EACV,UAAU,UAAU,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8FpB,iBACd,UAAU,eACV,kBAAkB,+BAChB,uBAAuB,UAEzB,UAAS,SAAS,qBAAqB,SAAS,aAChD,cAAc,SAAS,eACtB,SAAS,MAAM;;;;;;;;;;cCtHL,sBAAc;;;;;cAMd,wCAAmB,yBAAA;;;cCsCnB,oBAAW;cAeX,4BAAmB;cAQnB,uBAAc;cAMd,sBAAa"}
package/build/index.d.ts CHANGED
@@ -81,7 +81,8 @@ interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
81
81
  * Only applicable while rendering queries on the server with streaming.
82
82
  * Set `deferStream` to `true` to wait for the query to resolve on the server before flushing the stream.
83
83
  * This can be useful to avoid sending a loading state to the client before the query has resolved.
84
- * Defaults to `false`.
84
+ *
85
+ * @defaultValue false
85
86
  */
86
87
  deferStream?: boolean;
87
88
  /**
@@ -130,14 +131,16 @@ type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverR
130
131
  */
131
132
  type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
132
133
  /**
133
- * The object `useQuery` returns when `initialData` guarantees `data` is never `undefined`.
134
+ * The object `useQuery` returns when `initialData` guarantees `data` is never `undefined` (unless a
135
+ * `select` changes `TData` to include `undefined`).
134
136
  *
135
137
  * @template TData - The type `data` ends up as, after `select` runs (if set).
136
138
  * @template TError - The type of errors this query may hold.
137
139
  */
138
140
  type DefinedUseBaseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
139
141
  /**
140
- * The object `useQuery` returns when `initialData` guarantees `data` is never `undefined`.
142
+ * The object `useQuery` returns when `initialData` guarantees `data` is never `undefined` (unless a
143
+ * `select` changes `TData` to include `undefined`).
141
144
  *
142
145
  * @template TData - The type `data` ends up as, after `select` runs (if set).
143
146
  * @template TError - The type of errors this query may hold.
@@ -153,12 +156,21 @@ type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedUseB
153
156
  * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.
154
157
  */
155
158
  interface InfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryKey' | 'suspense'> {
159
+ /**
160
+ * The query key to use for this query. Required here, unlike on the options this type extends.
161
+ *
162
+ * The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/solid/guides/query-keys)
163
+ * for more information.
164
+ *
165
+ * The query will automatically update when this key changes (as long as `enabled` is not set to `false`).
166
+ */
156
167
  queryKey: TQueryKey;
157
168
  /**
158
169
  * Only applicable while rendering queries on the server with streaming.
159
170
  * Set `deferStream` to `true` to wait for the query to resolve on the server before flushing the stream.
160
171
  * This can be useful to avoid sending a loading state to the client before the query has resolved.
161
- * Defaults to `false`.
172
+ *
173
+ * @defaultValue false
162
174
  */
163
175
  deferStream?: boolean;
164
176
  /**
@@ -188,7 +200,8 @@ type UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TDat
188
200
  */
189
201
  type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
190
202
  /**
191
- * The object `useInfiniteQuery` returns when `initialData` guarantees `data` is never `undefined`.
203
+ * The object `useInfiniteQuery` returns when `initialData` guarantees `data` is never `undefined` (unless a
204
+ * `select` changes `TData` to include `undefined`).
192
205
  *
193
206
  * @template TData - The type `data` ends up as, after `select` runs (if set).
194
207
  * @template TError - The type of errors this query may hold.
@@ -271,7 +284,7 @@ type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError,
271
284
  }>;
272
285
  /**
273
286
  * The options accepted by the `queryOptions` overload selected when `initialData` is set — `data` is never
274
- * `undefined`.
287
+ * `undefined` (unless a `select` changes `TData` to include `undefined`).
275
288
  *
276
289
  * @template TQueryFnData - The type your `queryFn` resolves to.
277
290
  * @template TError - The type of errors your `queryFn` may throw.
@@ -286,7 +299,8 @@ type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TD
286
299
  * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and
287
300
  * is the query key to generate options for.
288
301
  *
289
- * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`.
302
+ * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless
303
+ * a `select` changes `TData` to include `undefined`).
290
304
  *
291
305
  * @see {@link useQuery} to run a query with these options.
292
306
  * @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, with `initialData` set.
@@ -360,6 +374,9 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
360
374
  //#endregion
361
375
  //#region src/useQuery.d.ts
362
376
  /**
377
+ * Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
378
+ * The query runs when the options call for it — `enabled: false` skips the initial fetch.
379
+ *
363
380
  * @see {@link queryOptions} to share these options between `useQuery` and imperative APIs like `queryClient.query`.
364
381
  * @param options - An accessor returning the {@link UndefinedInitialDataOptions} to use — everything you can
365
382
  * pass to `useQuery`.
@@ -469,7 +486,9 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
469
486
  * ```
470
487
  *
471
488
  * @example
472
- * Seeding a detail query from an already-cached list, to skip the loading state:
489
+ * Seeding a detail query from an already-cached list, to skip the loading state. `initialDataUpdatedAt` carries
490
+ * over the list's own fetch time, so that if you set a `staleTime`, it's measured from when the list was
491
+ * fetched rather than from now:
473
492
  * ```tsx
474
493
  * import { useQuery, useQueryClient } from '@tanstack/solid-query'
475
494
  *
@@ -483,6 +502,8 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
483
502
  * queryClient
484
503
  * .getQueryData<Array<Post>>(['posts'])
485
504
  * ?.find((post) => post.id === props.postId),
505
+ * initialDataUpdatedAt: () =>
506
+ * queryClient.getQueryState(['posts'])?.dataUpdatedAt,
486
507
  * }))
487
508
  *
488
509
  * return postQuery.isError ? <span>Error: {postQuery.error.message}</span> : <h1>{postQuery.data?.title}</h1>
@@ -522,7 +543,11 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
522
543
  */
523
544
  declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: () => QueryClient): UseQueryResult<TData, TError>;
524
545
  /**
525
- * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`.
546
+ * Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
547
+ * The query runs when the options call for it — `enabled: false` skips the initial fetch.
548
+ *
549
+ * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless
550
+ * a `select` changes `TData` to include `undefined`).
526
551
  *
527
552
  * @see {@link queryOptions} to share these options between `useQuery` and imperative APIs like `queryClient.query`.
528
553
  * @param options - An accessor returning the {@link DefinedInitialDataOptions} to use — everything you can
@@ -581,7 +606,7 @@ type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TD
581
606
  }>;
582
607
  /**
583
608
  * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is
584
- * never `undefined`.
609
+ * never `undefined` (unless a `select` changes `TData` to include `undefined`).
585
610
  *
586
611
  * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
587
612
  * @template TError - The type of errors your `queryFn` may throw.
@@ -836,6 +861,9 @@ declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = I
836
861
  //#endregion
837
862
  //#region src/useMutation.d.ts
838
863
  /**
864
+ * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
865
+ * `useMutation` is the primitive for that.
866
+ *
839
867
  * @param options - An accessor returning the {@link UseMutationOptions} to use.
840
868
  * @param queryClient - An accessor for a custom `QueryClient`. Otherwise, the one from the nearest context
841
869
  * will be used.
@@ -1048,7 +1076,7 @@ type QueriesOptions<T extends Array<any>, TResult extends Array<any> = [], TDept
1048
1076
  */
1049
1077
  type QueriesResults<T extends Array<any>, TResult extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResult, GetResults<Head>] : T extends [infer Head, ...infer Tail] ? QueriesResults<[...Tail], [...TResult, GetResults<Head>], [...TDepth, 1]> : { [K in keyof T]: GetResults<T[K]>; };
1050
1078
  /**
1051
- * The `useQueries` hook can be used to fetch a variable number of queries.
1079
+ * The `useQueries` primitive can be used to fetch a variable number of queries.
1052
1080
  *
1053
1081
  * The `queries` key accepts an array with query option objects mostly identical to `useQuery` — see
1054
1082
  * `placeholderData` below for the one difference. A custom `QueryClient` is supplied once, as `useQueries`'
@@ -1145,7 +1173,7 @@ declare function useQueries<T extends Array<any>, TCombinedResult extends Querie
1145
1173
  */
1146
1174
  declare const QueryClientContext: import("solid-js").Context<(() => QueryClient) | undefined>;
1147
1175
  /**
1148
- * The `useQueryClient` hook returns the current `QueryClient` instance.
1176
+ * The `useQueryClient` primitive returns the current `QueryClient` instance.
1149
1177
  *
1150
1178
  * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
1151
1179
  * be used.
@@ -1191,7 +1219,7 @@ declare const QueryClientProvider: (props: QueryClientProviderProps) => JSX.Elem
1191
1219
  //#endregion
1192
1220
  //#region src/useIsFetching.d.ts
1193
1221
  /**
1194
- * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching
1222
+ * The `useIsFetching` primitive returns the `number` of the queries that your application is loading or fetching
1195
1223
  * in the background (useful for app-wide loading indicators).
1196
1224
  *
1197
1225
  * @param filters - An accessor returning the {@link QueryFilters} to narrow down the matched queries.
@@ -1275,7 +1303,7 @@ declare function mutationOptions<TData = unknown, TError = DefaultError, TVariab
1275
1303
  //#endregion
1276
1304
  //#region src/useIsMutating.d.ts
1277
1305
  /**
1278
- * The `useIsMutating` hook returns the `number` of mutations that your application currently has `pending`
1306
+ * The `useIsMutating` primitive returns the `number` of mutations that your application currently has `pending`
1279
1307
  * (useful for app-wide loading indicators).
1280
1308
  *
1281
1309
  * @param filters - An accessor returning the {@link MutationFilters} to narrow down the matched mutations.
@@ -1304,7 +1332,7 @@ type MutationStateOptions<TResult = MutationState, TMutation extends Mutation<an
1304
1332
  select?: (mutation: TMutation) => TResult;
1305
1333
  };
1306
1334
  /**
1307
- * `useMutationState` is a hook that gives you access to all mutations in the `MutationCache`. You can pass
1335
+ * `useMutationState` is a primitive that gives you access to all mutations in the `MutationCache`. You can pass
1308
1336
  * `filters` ({@link MutationFilters}) to narrow down your mutations, and `select` to transform the mutation
1309
1337
  * state.
1310
1338
  *
@@ -1380,7 +1408,7 @@ declare function useMutationState<TResult = MutationState, TMutation extends Mut
1380
1408
  //#endregion
1381
1409
  //#region src/isRestoring.d.ts
1382
1410
  /**
1383
- * If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` hook alongside it to
1411
+ * If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` primitive alongside it to
1384
1412
  * check if a restore is currently in progress. `useQuery` and friends also check this internally to avoid
1385
1413
  * race conditions between the restore and mounting queries.
1386
1414
  *