Skip to content

Commit

Permalink
fix(solid-query): Correct error handling after SSR error (#7266)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardeora committed Apr 11, 2024
1 parent 5ace1bc commit 020a0a3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/solid-query/src/createBaseQuery.ts
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 020a0a3

Please sign in to comment.