NuxtN
Nuxt2y ago
Tony

useFetch refresh failing to recognise new query params

I have a simple page with this useFetch code at the start:
const { data, refresh } = await useFetch(`/api/images`, {
  query: {
    q: query.value
  }
});

watch(() => route.query.q, async () => {
  await refreshNuxtData();
  await refresh();
});


However refresh() won't use the new route query param. If I put {{ route.query.q }} in the page it shows the new query param but refreshing through the watch OR a button with refresh() manually shows the API as recieving the old query param

What's happening???
Was this page helpful?