Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tanstack/solid-query

Package Overview
Dependencies
Maintainers
2
Versions
303
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/solid-query - npm Package Compare versions

Comparing version 5.0.0-alpha.22 to 5.0.0-alpha.23

6

build/cjs/index.js

@@ -77,3 +77,3 @@ 'use strict';

defaultedOptions.retry = false;
defaultedOptions.throwErrors = true;
defaultedOptions.throwOnError = true;
}

@@ -215,3 +215,3 @@ const observer = new Observer(client(), defaultedOptions);

solidJs.createComputed(solidJs.on(() => state.status, () => {
if (state.isError && !state.isFetching && shouldThrowError(observer.options.throwErrors, [state.error, observer.getCurrentQuery()])) {
if (state.isError && !state.isFetching && shouldThrowError(observer.options.throwOnError, [state.error, observer.getCurrentQuery()])) {
throw state.error;

@@ -266,3 +266,3 @@ }

solidJs.createComputed(solidJs.on(() => state.status, () => {
if (state.isError && shouldThrowError(observer.options.throwErrors, [state.error])) {
if (state.isError && shouldThrowError(observer.options.throwOnError, [state.error])) {
throw state.error;

@@ -269,0 +269,0 @@ }

@@ -76,3 +76,3 @@ import { notifyManager, QueryClient as QueryClient$1, hydrate, QueryObserver, InfiniteQueryObserver, MutationObserver, QueriesObserver } from '@tanstack/query-core';

defaultedOptions.retry = false;
defaultedOptions.throwErrors = true;
defaultedOptions.throwOnError = true;
}

@@ -214,3 +214,3 @@ const observer = new Observer(client(), defaultedOptions);

createComputed(on(() => state.status, () => {
if (state.isError && !state.isFetching && shouldThrowError(observer.options.throwErrors, [state.error, observer.getCurrentQuery()])) {
if (state.isError && !state.isFetching && shouldThrowError(observer.options.throwOnError, [state.error, observer.getCurrentQuery()])) {
throw state.error;

@@ -265,3 +265,3 @@ }

createComputed(on(() => state.status, () => {
if (state.isError && shouldThrowError(observer.options.throwErrors, [state.error])) {
if (state.isError && shouldThrowError(observer.options.throwOnError, [state.error])) {
throw state.error;

@@ -268,0 +268,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;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]}})}))}));
!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.throwOnError=!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.throwOnError,[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.throwOnError,[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.22",
"version": "5.0.0-alpha.23",
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid",

@@ -46,3 +46,3 @@ "author": "tannerlinsley",

"dependencies": {
"@tanstack/query-core": "5.0.0-alpha.21"
"@tanstack/query-core": "5.0.0-alpha.23"
},

@@ -49,0 +49,0 @@ "peerDependencies": {

@@ -65,3 +65,3 @@ /* eslint-disable @typescript-eslint/no-unnecessary-condition */

defaultedOptions.retry = false
defaultedOptions.throwErrors = true
defaultedOptions.throwOnError = true
}

@@ -245,3 +245,3 @@ const observer = new Observer(client(), defaultedOptions)

!state.isFetching &&
shouldThrowError(observer.options.throwErrors, [
shouldThrowError(observer.options.throwOnError, [
state.error,

@@ -248,0 +248,0 @@ observer.getCurrentQuery(),

@@ -57,3 +57,3 @@ import type { DefaultError } from '@tanstack/query-core'

state.isError &&
shouldThrowError(observer.options.throwErrors, [state.error])
shouldThrowError(observer.options.throwOnError, [state.error])
) {

@@ -60,0 +60,0 @@ throw state.error

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc