Skip to content

Commit

Permalink
fix: indexDb in server
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed Oct 19, 2023
1 parent c5dc453 commit 0a1eea5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/providers/root/react-query-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import type { PropsWithChildren } from 'react'

import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister'

const dbStore = createStore('react-query', 'queries')
import { isServerSide } from '~/lib/env'

const dbStore = isServerSide ? undefined : createStore('react-query', 'queries')

const asyncStoragePersister = createAsyncStoragePersister({
storage: {
Expand Down Expand Up @@ -45,7 +47,10 @@ const persistOptions: Omit<PersistQueryClientOptions, 'queryClient'> = {
if (query.meta?.persist === false) return false

if (queryIsReadyForPersistance) {
return !((query.state?.data as any)?.pages?.length > 1)
return (
!((query.state?.data as any)?.pages?.length > 1) ||
(!!query.state.data && !(query.state.data as any).pages)
)
} else {
return false
}
Expand Down

1 comment on commit 0a1eea5

@vercel
Copy link

@vercel vercel bot commented on 0a1eea5 Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

shiro-git-main-innei.vercel.app
innei.in
springtide.vercel.app
shiro-innei.vercel.app

Please sign in to comment.