From ffa6f6741a660686be2b0f43082a1aaed4ae6d0c Mon Sep 17 00:00:00 2001 From: Aryan Deora Date: Wed, 5 Apr 2023 00:13:10 -0400 Subject: [PATCH] fix(solid-query): Fix non hydrating queries (#5229) --- packages/solid-query/src/createBaseQuery.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/solid-query/src/createBaseQuery.ts b/packages/solid-query/src/createBaseQuery.ts index 2688e292a5..00dc80f78a 100644 --- a/packages/solid-query/src/createBaseQuery.ts +++ b/packages/solid-query/src/createBaseQuery.ts @@ -64,8 +64,9 @@ export function createBaseQuery< return observer.subscribe((result) => { notifyManager.batchCalls(() => { const query = observer.getCurrentQuery() + const { refetch, ...rest } = unwrap(result) const unwrappedResult = { - ...unwrap(result), + ...rest, // hydrate() expects a QueryState object, which is similar but not // quite the same as a QueryObserverResult object. Thus, for now, we're @@ -84,7 +85,9 @@ export function createBaseQuery< reject(unwrappedResult.error) } if (unwrappedResult.isSuccess) { - resolve(unwrappedResult) + // Use of any here is fine + // We cannot include refetch since it is not serializable + resolve(unwrappedResult as any) } })() })