Skip to content

is it possible to fully reset all pinia colada cache? #263

Closed Answered by posva
tednaaa asked this question in Questions
Discussion options

You must be logged in to vote

You can invalidate all the relevant queries or even remove them, set a pending state:

const queryCache = useQueryCache()

// by default only active queries are invalidated
queryCache.invalidateQueries({ active: null })

for (const entry of queryCache.getEntries()) {
  queryCache.remove(entry) // or setEntryState(entry, { status: 'pending', data: undefined, error: null })
}

You can pass more filters to both invalidateQueries and getEntries to only affect authenticated queries. You could even include that in the key and use predicate function

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tednaaa
Comment options

@posva
Comment options

@tednaaa
Comment options

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