@tanstack/solid-query
Advanced tools
Comparing version 5.24.2 to 5.24.3
@@ -90,2 +90,3 @@ import { notifyManager, QueryClient as QueryClient$1, MutationObserver, replaceEqualDeep, QueriesObserver, hydrate, QueryObserver, InfiniteQueryObserver } from '@tanstack/query-core'; | ||
const isRestoring = useIsRestoring(); | ||
let unsubscribeQueued = false; | ||
const defaultedOptions = createMemo(() => { | ||
@@ -114,4 +115,6 @@ const defaultOptions = client().defaultQueryOptions(options()); | ||
reject(unwrappedResult.error); | ||
unsubscribeIfQueued(); | ||
} else { | ||
resolve(unwrappedResult); | ||
unsubscribeIfQueued(); | ||
} | ||
@@ -121,2 +124,8 @@ })(); | ||
}; | ||
const unsubscribeIfQueued = () => { | ||
if (unsubscribeQueued) { | ||
unsubscribe?.(); | ||
unsubscribeQueued = false; | ||
} | ||
}; | ||
const createClientSubscriber = () => { | ||
@@ -230,2 +239,6 @@ const obs = observer(); | ||
onCleanup(() => { | ||
if (isServer && queryResource.loading) { | ||
unsubscribeQueued = true; | ||
return; | ||
} | ||
if (unsubscribe) { | ||
@@ -232,0 +245,0 @@ unsubscribe(); |
@@ -90,2 +90,3 @@ import { notifyManager, QueryClient as QueryClient$1, MutationObserver, replaceEqualDeep, QueriesObserver, hydrate, QueryObserver, InfiniteQueryObserver } from '@tanstack/query-core'; | ||
const isRestoring = useIsRestoring(); | ||
let unsubscribeQueued = false; | ||
const defaultedOptions = createMemo(() => { | ||
@@ -114,4 +115,6 @@ const defaultOptions = client().defaultQueryOptions(options()); | ||
reject(unwrappedResult.error); | ||
unsubscribeIfQueued(); | ||
} else { | ||
resolve(unwrappedResult); | ||
unsubscribeIfQueued(); | ||
} | ||
@@ -121,2 +124,8 @@ })(); | ||
}; | ||
const unsubscribeIfQueued = () => { | ||
if (unsubscribeQueued) { | ||
unsubscribe?.(); | ||
unsubscribeQueued = false; | ||
} | ||
}; | ||
const createClientSubscriber = () => { | ||
@@ -230,2 +239,6 @@ const obs = observer(); | ||
onCleanup(() => { | ||
if (isServer && queryResource.loading) { | ||
unsubscribeQueued = true; | ||
return; | ||
} | ||
if (unsubscribe) { | ||
@@ -232,0 +245,0 @@ unsubscribe(); |
{ | ||
"name": "@tanstack/solid-query", | ||
"version": "5.24.2", | ||
"version": "5.24.3", | ||
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -123,2 +123,7 @@ // Had to disable the lint rule because isServer type is defined as false | ||
const isRestoring = useIsRestoring() | ||
// There are times when we run a query on the server but the resource is never read | ||
// This could lead to times when the queryObserver is unsubscribed before the resource has loaded | ||
// Causing a time out error. To prevent this we will queue the unsubscribe if the cleanup is called | ||
// before the resource has loaded | ||
let unsubscribeQueued = false | ||
@@ -159,4 +164,6 @@ const defaultedOptions = createMemo(() => { | ||
reject(unwrappedResult.error) | ||
unsubscribeIfQueued() | ||
} else { | ||
resolve(unwrappedResult) | ||
unsubscribeIfQueued() | ||
} | ||
@@ -167,2 +174,9 @@ })() | ||
const unsubscribeIfQueued = () => { | ||
if (unsubscribeQueued) { | ||
unsubscribe?.() | ||
unsubscribeQueued = false | ||
} | ||
} | ||
const createClientSubscriber = () => { | ||
@@ -301,2 +315,6 @@ const obs = observer() | ||
onCleanup(() => { | ||
if (isServer && queryResource.loading) { | ||
unsubscribeQueued = true | ||
return | ||
} | ||
if (unsubscribe) { | ||
@@ -303,0 +321,0 @@ unsubscribe() |
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
438117
13277