Skip to content
Discussion options

You must be logged in to vote

You can do it with a plugin that resets the data and error on every fetch (or another action, depending on your use case). The code should look like this:

app.use(PiniaColada, {
  queryOptions: {
    staleTime: 0,
    gcTime: 0
  },
  plugins: [
    ({ queryCache }) => {
      queryCache.$onAction(({ name, args }) => {
        if (name === 'fetch') {
          const [entry] = args
          queryCache.setEntryState(entry, { status: 'pending', data: null, error: null })
        }
      })
    },
  ],
} satisfies PiniaColadaOptions)

But then, there is simply no point in having a cache

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@boneus
Comment options

@posva
Comment options

@boneus
Comment options

@posva
Comment options

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