We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxi 3.0.0-rc.12 11:37:18 RootDir: /Users/staffan/dev/giglets/site/frontend 11:37:18 Nuxt project info: (copied to clipboard) 11:37:18
Darwin
v14.20.1
3.0.0-rc.12
0.6.0
yarn@1.22.19
vite
runtimeConfig
ssr
sourcemap
app
modules
proxy
@nuxtjs-alt/proxy@1.3.7
-
app.vue:
<script setup> const count = ref(1); const data = ref(''); watch(count, () => useFetch('/api/hello/', { key: 'hello' }).then( (r) => (data.value = r.data.value) ) ); </script> <template> <NuxtExampleLayout example="composables/use-fetch"> <div> Fetch result: <pre class="text-left"><code>{{ data }}</code></pre> <NButton @click=" clearNuxtData('$fhello'); count++; " > Works </NButton> <NButton @click=" clearNuxtData('hello'); count++; " > Does not work </NButton> </div> </NuxtExampleLayout> </template>
server/api/[...hello].ts:
let seq = 1; export default defineEventHandler((event) => ({ seq: seq++, }));
useFetch is called with an explicit key and that same value is used in clearNuxtData to clear the cached data and force a refresh.
useFetch
key
clearNuxtData
Expected result: The cache is cleared and new data is fetched.
Actual result: The cache is not cleared and no data is fetched.
Workaround: Prepend the key with $f when calling clearNuxtData. This works, but is not the documented behaviour.
$f
No response
The text was updated successfully, but these errors were encountered:
@pi0 do you think we could drop the $f prefix for explicitly provided keys to useFetch?
Sorry, something went wrong.
danielroe
Successfully merging a pull request may close this issue.
Environment
Nuxi 3.0.0-rc.12 11:37:18
RootDir: /Users/staffan/dev/giglets/site/frontend 11:37:18
Nuxt project info: (copied to clipboard) 11:37:18
Darwin
v14.20.1
3.0.0-rc.12
0.6.0
yarn@1.22.19
vite
runtimeConfig
,ssr
,sourcemap
,app
,modules
,proxy
,vite
@nuxtjs-alt/proxy@1.3.7
-
Reproduction
app.vue:
server/api/[...hello].ts:
Describe the bug
useFetch
is called with an explicitkey
and that same value is used inclearNuxtData
to clear the cached data and force a refresh.Expected result:
The cache is cleared and new data is fetched.
Actual result:
The cache is not cleared and no data is fetched.
Workaround:
Prepend the key with
$f
when callingclearNuxtData
. This works, but is not the documented behaviour.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: