You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created a composable around useFetch to simplify the usage of getCachedData. However I've noticed that there was a repeated request sent if getCachedData is passed as the options for useFetch.
If the getCachedData is not passed as an option, the request is only sent once.
Additional context
I initially stumble upon this bug after noticing that a weird behavior whereby if i refresh the page it would display my data as usual and the data request is fetched on the client once again causing a flicker when using v-if / v-else
Logs
------------------
With getCachedData
------------------
hit apiFetch
Cache disabled || invalidateCache /api/test falsefalse
Cache disabled || invalidateCache /api/test falsefalse
Cache disabled || invalidateCache /api/test falsefalse
hit server api
hit apiFetch
Cache disabled || invalidateCache /api/test falsefalse
Cache disabled || invalidateCache /api/test falsefalse
Cache disabled || invalidateCache /api/test falsefalse
hit server api
hit server api
---------------------
Without getCachedData
---------------------
hit apiFetch
hit server api
The text was updated successfully, but these errors were encountered:
Environment
Reproduction
https://stackblitz.com/edit/github-fu2dhl?file=composables%2FapiFetch.ts
Describe the bug
I've created a composable around
useFetch
to simplify the usage ofgetCachedData
. However I've noticed that there was a repeated request sent if getCachedData is passed as the options foruseFetch
.If the getCachedData is not passed as an option, the request is only sent once.
Additional context
I initially stumble upon this bug after noticing that a weird behavior whereby if i refresh the page it would display my data as usual and the data request is fetched on the client once again causing a flicker when using v-if / v-else
Logs
The text was updated successfully, but these errors were encountered: