From 0a1308df6b875e48b14deaadddfc677eabe328c9 Mon Sep 17 00:00:00 2001 From: Aryan Deora Date: Wed, 5 Apr 2023 00:06:47 -0400 Subject: [PATCH] fix(solid-query): Fix non hydrating queries --- 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) } })() })