Skip to content
Discussion options

You must be logged in to vote

you can provide a custom function in the dehydrateOptions that will include or exclude a query:

<PersistQueryClientProvider
  persistOptions={{
    dehydrateOptions: {
      shouldDehydrateQuery: (query) => // return true or false for each query
    }
  }}
>
</PersistQueryClientProvider>

Please note that the default implementation is:

function defaultShouldDehydrateQuery(query: Query) {
  return query.state.status === 'success'
}

so you might want to keep that check. What works well is additionally match the query.queryKey or query.meta to check if something has been marked for exclusion.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@franferns
Comment options

@franferns
Comment options

Answer selected by franferns
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