Skip to content

Cache individual but request multiple #158

Answered by posva
NikitaVelixJob asked this question in Questions
Discussion options

You must be logged in to vote

Make the key a function:

const itemId = ref() // or any reactive value like route.params.id

useQuery({
  key: () => ['items', itemId.value]
})

You will find more in https://pinia-colada.esm.dev/guide/queries.html#Reusable-Queries

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@posva
Comment options

@NikitaVelixJob
Comment options

@NikitaVelixJob
Comment options

@posva
Comment options

@NikitaVelixJob
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