ygor perez
ygor perez
TtRPC
Created by ygor perez on 5/13/2023 in #❓-help
How do I prefetch the nextPage of an infiniteQuery?
I already do this, but if the user scrolls to fast I would want to have it prefetched
7 replies
TtRPC
Created by ygor perez on 5/9/2023 in #❓-help
how to persist the query client?
I created this hook, I call it in the app.tsx file
18 replies
TtRPC
Created by ygor perez on 5/9/2023 in #❓-help
how to persist the query client?
18 replies
TtRPC
Created by ygor perez on 5/13/2023 in #❓-help
How do I prefetch the nextPage of an infiniteQuery?
Sorry I didn't fully comprehend what you said, could you give me an example or try explaining it in another way please? Are you talking about a parameter for how many items to retrieve?
7 replies
TtRPC
Created by ygor perez on 5/9/2023 in #❓-help
how to persist the query client?
oh! for some reason I mixed useQueryClient with useQuery, thank you very much that was exactly what I needed, I read the bit of documentation in https://trpc.io/docs/migrate-from-v9-to-v10 "queryClient is no longer exposed through tRPC context", but for some reason flew over my head.
18 replies
TtRPC
Created by ygor perez on 5/9/2023 in #❓-help
how to persist the query client?
I just can't access it
18 replies
TtRPC
Created by ygor perez on 5/9/2023 in #❓-help
how to persist the query client?
but trpc already creates one right?
18 replies
TtRPC
Created by ygor perez on 5/9/2023 in #❓-help
how to persist the query client?
Do you know if I would have to use the useQueryClient through RQ in all my procedures for the caching to work? Different queryClients different caches?
18 replies
TtRPC
Created by Igor_lviv on 5/10/2023 in #❓-help
How to upload file not use S3 Next js? Please, example
this video might help you out: https://youtu.be/mxT3j-5s1Zc
4 replies
TtRPC
Created by ygor perez on 5/9/2023 in #❓-help
how to persist the query client?
Thank you for the reply, yes I'm on NextJS 13 without the app directory.
import { persistQueryClient } from '@tanstack/react-query-persist-client'
import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister'

const queryClient = new QueryClient({
defaultOptions: {
queries: {
cacheTime: 1000 * 60 * 60 * 24, // 24 hours
},
},
})

const localStoragePersister = createSyncStoragePersister({ storage: window.localStorage })
// const sessionStoragePersister = createSyncStoragePersister({ storage: window.sessionStorage })

persistQueryClient({
queryClient,
persister: localStoragePersister,
})
import { persistQueryClient } from '@tanstack/react-query-persist-client'
import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister'

const queryClient = new QueryClient({
defaultOptions: {
queries: {
cacheTime: 1000 * 60 * 60 * 24, // 24 hours
},
},
})

const localStoragePersister = createSyncStoragePersister({ storage: window.localStorage })
// const sessionStoragePersister = createSyncStoragePersister({ storage: window.sessionStorage })

persistQueryClient({
queryClient,
persister: localStoragePersister,
})
This is how you use the persistQueryClient from the docs, I would like to know if there is a way to get the queryClient from TRPC in v10
18 replies