-
Notifications
You must be signed in to change notification settings - Fork 41
Description
When using the useSanityQuery the query fails to update the data state when a reactive parameter passed to it changes. This issue occurs both when the refresh function is called directly and when a reactive dependency is modified.
Using the more explicit useAsyncData composable with a manual watch on the reactive parameter correctly triggers a refetch and updates the data.
Version
module: 1.13.3
nuxt: 3.17.5
Reproduction
This issue exists which refresh is called directly and when a reactive parameter changes
`
// this makes a network request to sanity but does not update the data state
const { data } = useSanityQuery(articleByDateQuery, { date: dateRef })
// this works and correctly updates data
const { data } = useAsyncData('articles', () => sanity.fetch(articleByDateQuery, { date: dateRef.value }), {watch: [dateRef]})
`