@tanstack/solid-query
Advanced tools
Comparing version 5.0.0-alpha.21 to 5.0.0-alpha.22
@@ -96,4 +96,5 @@ 'use strict'; | ||
fetchFailureCount: query.state.fetchFailureCount, | ||
fetchFailureReason: query.state.fetchFailureReason, | ||
fetchMeta: query.state.fetchMeta, | ||
// Removing these properties since they might not be serializable | ||
// fetchFailureReason: query.state.fetchFailureReason, | ||
// fetchMeta: query.state.fetchMeta, | ||
isInvalidated: query.state.isInvalidated | ||
@@ -100,0 +101,0 @@ }; |
@@ -95,4 +95,5 @@ import { notifyManager, QueryClient as QueryClient$1, hydrate, QueryObserver, InfiniteQueryObserver, MutationObserver, QueriesObserver } from '@tanstack/query-core'; | ||
fetchFailureCount: query.state.fetchFailureCount, | ||
fetchFailureReason: query.state.fetchFailureReason, | ||
fetchMeta: query.state.fetchMeta, | ||
// Removing these properties since they might not be serializable | ||
// fetchFailureReason: query.state.fetchFailureReason, | ||
// fetchMeta: query.state.fetchMeta, | ||
isInvalidated: query.state.isInvalidated | ||
@@ -99,0 +100,0 @@ }; |
@@ -42,4 +42,5 @@ import { hydrate } from '@tanstack/query-core'; | ||
fetchFailureCount: query.state.fetchFailureCount, | ||
fetchFailureReason: query.state.fetchFailureReason, | ||
fetchMeta: query.state.fetchMeta, | ||
// Removing these properties since they might not be serializable | ||
// fetchFailureReason: query.state.fetchFailureReason, | ||
// fetchMeta: query.state.fetchMeta, | ||
isInvalidated: query.state.isInvalidated, | ||
@@ -46,0 +47,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tanstack/query-core"),require("solid-js"),require("solid-js/web"),require("solid-js/store")):"function"==typeof define&&define.amd?define(["exports","@tanstack/query-core","solid-js","solid-js/web","solid-js/store"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).index={},e.QueryCore,e.Solid,e.SolidWeb,e.SolidStore)}(this,(function(e,t,r,n,o){"use strict";t.notifyManager.setBatchNotifyFunction(r.batch);class i extends t.QueryClient{constructor(e={}){super(e)}}const s=r.createContext(void 0),u=e=>{const t=r.useContext(s);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};function a(e,t){return"function"==typeof e?e(...t):!!e}function c(e,t,r){if(!1===r)return t;if("function"==typeof r){const n=r(e.data,t.data);return{...t,data:n}}const n=o.reconcile(t.data,{key:r})(e.data);return{...t,data:n}}function l(e,i,s){const l=r.createMemo((()=>u(s?.()))),d=l().defaultQueryOptions(e());d._optimisticResults="optimistic",d.structuralSharing=!1,n.isServer&&(d.retry=!1,d.throwErrors=!0);const f=new i(l(),d),[p,y]=o.createStore(f.getOptimisticResult(d)),m=()=>f.subscribe((e=>{t.notifyManager.batchCalls((()=>{const t=f.options.reconcile;C()?.data&&e.data&&!C.loading?(y((r=>c(r,e,void 0===t?"id":t))),b(p)):(y((r=>c(r,e,void 0===t?"id":t))),g())}))()}));let h=null;const[C,{refetch:g,mutate:b}]=r.createResource((()=>new Promise(((e,r)=>{n.isServer?h=((e,r)=>f.subscribe((n=>{t.notifyManager.batchCalls((()=>{const t=f.getCurrentQuery(),{refetch:i,...s}=o.unwrap(n),u={...s,dataUpdateCount:t.state.dataUpdateCount,fetchFailureCount:t.state.fetchFailureCount,fetchFailureReason:t.state.fetchFailureReason,fetchMeta:t.state.fetchMeta,isInvalidated:t.state.isInvalidated};u.isError&&("development"===process.env.NODE_ENV&&console.error(u.error),r(u.error)),u.isSuccess&&e(u)}))()})))(e,r):h||(h=m()),p.isLoading||e(p)}))),{initialValue:p,ssrLoadFrom:e().initialData?"initial":"server",get deferStream(){return e().deferStream},onHydrated(e,r){if(r.value&&t.hydrate(l(),{queries:[{queryKey:d.queryKey,queryHash:d.queryHash,state:r.value}]}),!h){const e={...d};!d.staleTime&&d.initialData||(e.refetchOnMount=!1),f.setOptions(e),y(f.getOptimisticResult(e)),h=m()}}});r.onCleanup((()=>{h&&(h(),h=null)})),r.createComputed(r.on((()=>l().defaultQueryOptions(e())),(()=>f.setOptions(l().defaultQueryOptions(e()))),{defer:!0})),r.createComputed(r.on((()=>p.status),(()=>{if(p.isError&&!p.isFetching&&a(f.options.throwErrors,[p.error,f.getCurrentQuery()]))throw p.error})));return new Proxy(p,{get(e,t){const r=C()?.[t];return void 0!==r?r:Reflect.get(e,t)}})}function d(){}e.QueryClient=i,e.QueryClientContext=s,e.QueryClientProvider=e=>(r.onMount((()=>{e.client.mount()})),r.onCleanup((()=>e.client.unmount())),n.createComponent(s.Provider,{get value(){return e.client},get children(){return e.children}})),e.createInfiniteQuery=function(e,n){return l(r.createMemo((()=>e())),t.InfiniteQueryObserver,n)},e.createMutation=function(e,n){const i=u(n?.()),s=new t.MutationObserver(i,e()),c=(e,t)=>{s.mutate(e,t).catch(d)},[l,f]=o.createStore({...s.getCurrentResult(),mutate:c,mutateAsync:s.getCurrentResult().mutate});r.createComputed((()=>{s.setOptions(e())})),r.createComputed(r.on((()=>l.status),(()=>{if(l.isError&&a(s.options.throwErrors,[l.error]))throw l.error})));const p=s.subscribe((e=>{f({...e,mutate:c,mutateAsync:e.mutate})}));return r.onCleanup(p),l},e.createQueries=function(e,n){const i=u(n?.()),s=e().queries.map((e=>{const t=i.defaultQueryOptions(e);return t._optimisticResults="optimistic",t})),a=new t.QueriesObserver(i,s),[c,l]=o.createStore(a.getOptimisticResult(s)),d=a.subscribe((e=>{t.notifyManager.batchCalls((()=>{l(o.unwrap(e))}))()}));return r.onCleanup(d),r.onMount((()=>{a.setQueries(s,{listeners:!1})})),r.createComputed((()=>{const t=e().queries.map((e=>{const t=i.defaultQueryOptions(e);return t._optimisticResults="optimistic",t}));a.setQueries(t)})),c},e.createQuery=function(e,n){return l(r.createMemo((()=>e())),t.QueryObserver,n)},e.useIsFetching=function(e,t){const n=r.createMemo((()=>u(t?.()))),o=r.createMemo((()=>n().getQueryCache())),[i,s]=r.createSignal(n().isFetching(e?.())),a=o().subscribe((()=>{s(n().isFetching(e?.()))}));return r.onCleanup(a),i},e.useIsMutating=function(e,t){const n=r.createMemo((()=>u(t?.()))),o=r.createMemo((()=>n().getMutationCache())),[i,s]=r.createSignal(n().isMutating(e?.())),a=o().subscribe((t=>{s(n().isMutating(e?.()))}));return r.onCleanup(a),i},e.useQueryClient=u,Object.keys(t).forEach((function(r){"default"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}))})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tanstack/query-core"),require("solid-js"),require("solid-js/web"),require("solid-js/store")):"function"==typeof define&&define.amd?define(["exports","@tanstack/query-core","solid-js","solid-js/web","solid-js/store"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).index={},e.QueryCore,e.Solid,e.SolidWeb,e.SolidStore)}(this,(function(e,t,r,n,o){"use strict";t.notifyManager.setBatchNotifyFunction(r.batch);class i extends t.QueryClient{constructor(e={}){super(e)}}const s=r.createContext(void 0),u=e=>{const t=r.useContext(s);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};function a(e,t){return"function"==typeof e?e(...t):!!e}function c(e,t,r){if(!1===r)return t;if("function"==typeof r){const n=r(e.data,t.data);return{...t,data:n}}const n=o.reconcile(t.data,{key:r})(e.data);return{...t,data:n}}function l(e,i,s){const l=r.createMemo((()=>u(s?.()))),d=l().defaultQueryOptions(e());d._optimisticResults="optimistic",d.structuralSharing=!1,n.isServer&&(d.retry=!1,d.throwErrors=!0);const f=new i(l(),d),[p,y]=o.createStore(f.getOptimisticResult(d)),m=()=>f.subscribe((e=>{t.notifyManager.batchCalls((()=>{const t=f.options.reconcile;h()?.data&&e.data&&!h.loading?(y((r=>c(r,e,void 0===t?"id":t))),b(p)):(y((r=>c(r,e,void 0===t?"id":t))),g())}))()}));let C=null;const[h,{refetch:g,mutate:b}]=r.createResource((()=>new Promise(((e,r)=>{n.isServer?C=((e,r)=>f.subscribe((n=>{t.notifyManager.batchCalls((()=>{const t=f.getCurrentQuery(),{refetch:i,...s}=o.unwrap(n),u={...s,dataUpdateCount:t.state.dataUpdateCount,fetchFailureCount:t.state.fetchFailureCount,isInvalidated:t.state.isInvalidated};u.isError&&("development"===process.env.NODE_ENV&&console.error(u.error),r(u.error)),u.isSuccess&&e(u)}))()})))(e,r):C||(C=m()),p.isLoading||e(p)}))),{initialValue:p,ssrLoadFrom:e().initialData?"initial":"server",get deferStream(){return e().deferStream},onHydrated(e,r){if(r.value&&t.hydrate(l(),{queries:[{queryKey:d.queryKey,queryHash:d.queryHash,state:r.value}]}),!C){const e={...d};!d.staleTime&&d.initialData||(e.refetchOnMount=!1),f.setOptions(e),y(f.getOptimisticResult(e)),C=m()}}});r.onCleanup((()=>{C&&(C(),C=null)})),r.createComputed(r.on((()=>l().defaultQueryOptions(e())),(()=>f.setOptions(l().defaultQueryOptions(e()))),{defer:!0})),r.createComputed(r.on((()=>p.status),(()=>{if(p.isError&&!p.isFetching&&a(f.options.throwErrors,[p.error,f.getCurrentQuery()]))throw p.error})));return new Proxy(p,{get(e,t){const r=h()?.[t];return void 0!==r?r:Reflect.get(e,t)}})}function d(){}e.QueryClient=i,e.QueryClientContext=s,e.QueryClientProvider=e=>(r.onMount((()=>{e.client.mount()})),r.onCleanup((()=>e.client.unmount())),n.createComponent(s.Provider,{get value(){return e.client},get children(){return e.children}})),e.createInfiniteQuery=function(e,n){return l(r.createMemo((()=>e())),t.InfiniteQueryObserver,n)},e.createMutation=function(e,n){const i=u(n?.()),s=new t.MutationObserver(i,e()),c=(e,t)=>{s.mutate(e,t).catch(d)},[l,f]=o.createStore({...s.getCurrentResult(),mutate:c,mutateAsync:s.getCurrentResult().mutate});r.createComputed((()=>{s.setOptions(e())})),r.createComputed(r.on((()=>l.status),(()=>{if(l.isError&&a(s.options.throwErrors,[l.error]))throw l.error})));const p=s.subscribe((e=>{f({...e,mutate:c,mutateAsync:e.mutate})}));return r.onCleanup(p),l},e.createQueries=function(e,n){const i=u(n?.()),s=e().queries.map((e=>{const t=i.defaultQueryOptions(e);return t._optimisticResults="optimistic",t})),a=new t.QueriesObserver(i,s),[c,l]=o.createStore(a.getOptimisticResult(s)),d=a.subscribe((e=>{t.notifyManager.batchCalls((()=>{l(o.unwrap(e))}))()}));return r.onCleanup(d),r.onMount((()=>{a.setQueries(s,{listeners:!1})})),r.createComputed((()=>{const t=e().queries.map((e=>{const t=i.defaultQueryOptions(e);return t._optimisticResults="optimistic",t}));a.setQueries(t)})),c},e.createQuery=function(e,n){return l(r.createMemo((()=>e())),t.QueryObserver,n)},e.useIsFetching=function(e,t){const n=r.createMemo((()=>u(t?.()))),o=r.createMemo((()=>n().getQueryCache())),[i,s]=r.createSignal(n().isFetching(e?.())),a=o().subscribe((()=>{s(n().isFetching(e?.()))}));return r.onCleanup(a),i},e.useIsMutating=function(e,t){const n=r.createMemo((()=>u(t?.()))),o=r.createMemo((()=>n().getMutationCache())),[i,s]=r.createSignal(n().isMutating(e?.())),a=o().subscribe((t=>{s(n().isMutating(e?.()))}));return r.onCleanup(a),i},e.useQueryClient=u,Object.keys(t).forEach((function(r){"default"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}))})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@tanstack/solid-query", | ||
"version": "5.0.0-alpha.21", | ||
"version": "5.0.0-alpha.22", | ||
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -94,4 +94,5 @@ /* eslint-disable @typescript-eslint/no-unnecessary-condition */ | ||
fetchFailureCount: query.state.fetchFailureCount, | ||
fetchFailureReason: query.state.fetchFailureReason, | ||
fetchMeta: query.state.fetchMeta, | ||
// Removing these properties since they might not be serializable | ||
// fetchFailureReason: query.state.fetchFailureReason, | ||
// fetchMeta: query.state.fetchMeta, | ||
isInvalidated: query.state.isInvalidated, | ||
@@ -98,0 +99,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
821094
20528