From 41e7bf485e36ccfbda1f83b5e3d838d0b61c109d Mon Sep 17 00:00:00 2001 From: Aryan Deora Date: Thu, 11 Apr 2024 09:55:57 -0400 Subject: [PATCH] fix(solid-query): Correct error handling after SSR error --- packages/solid-query/src/createBaseQuery.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/solid-query/src/createBaseQuery.ts b/packages/solid-query/src/createBaseQuery.ts index adfaa39559..9621271a92 100644 --- a/packages/solid-query/src/createBaseQuery.ts +++ b/packages/solid-query/src/createBaseQuery.ts @@ -187,7 +187,12 @@ export function createBaseQuery< // If the query has data we don't suspend but instead mutate the resource // This could happen when placeholderData/initialData is defined - if (queryResource()?.data && result.data && !queryResource.loading) { + if ( + !queryResource.error && + queryResource()?.data && + result.data && + !queryResource.loading + ) { setState((store) => { return reconcileFn( store, @@ -273,7 +278,10 @@ export function createBaseQuery< * even if `staleTime` is not set. */ const newOptions = { ...initialOptions } - if (initialOptions.staleTime || !initialOptions.initialData) { + if ( + (initialOptions.staleTime || !initialOptions.initialData) && + info.value + ) { newOptions.refetchOnMount = false } // Setting the options as an immutable object to prevent