Skip to content
Discussion options

You must be logged in to vote

if your search goes to empty string, before you set it to local state, you can do:

queryClient.setQueryData(
    ['infinite-brands', { search: '', locale: 'en_GB' }]
    data => ({ pages: data?.pages.slice(0,1) ?? [], pageParams: data?.pageParams.slice(0,1) ?? [] })
)

this should reduce the the pages in the cache to the first page only.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@TkDodo
Comment options

@TkDodo
Comment options

@b-ferreira
Comment options

@TkDodo
Comment options

@b-ferreira
Comment options

Answer selected by TkDodo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants