Tumulte
How do you refresh a fetch with a dynamic path (/api/page/[id])
I have a hard time understanding that doc https://nuxt.com/docs/getting-started/data-fetching#computed-url
Basically I have a fetch
{data, refresh} = useFetch("/api/${dynamicID}")
(<- I know it’s suposed to be )
but when I refresh the dynamicID doesn’t change which is normal... but what’s the workaround (note that I can’t use
watch because it’s on
immediate: false` and I need to refresh it on cue) ?11 replies
registerEndpoint returning data from a previous registerEnpoint
I have 2 end points for a test...
but when I call the second enpoint, it gives me the data from the first
{query:... content:...}
however if I swap their position in the test code to match the order they are called... it works
I don't understand why the position should matter and the documentation says nothing3 replies
global registerEndpoint ? (for all tests)
I have middleware that checks and calls a route, and vitest really doesn't like it : every test gives a warning that my route
auth/me
doesn't exist.
Is there a way to mock it for all tests ? I've tried registerEndpoint in setupFiles
but no change
thanks1 replies
Is it possible to add descriptions to the nitro experimental openAPI/scalar autogenerated doc ?
The doc auto generation works well, but I can't find how to add descriptions to any given route ? I've read the docs but I don't find anything relevant
1 replies
How to mock useRoute in nuxt ?
I would just like to access
route.params.id
in vitest BUT, I cannot mock useRoute
the way we used to in Nuxt.
No matter what, route.params.id is undefined
I've tried seting up a route in mountSuspended
but to no success.
What's the proper way ?
Thanks4 replies
Does useState() a default value when the state key already set ?
The doc is unclear on the topic and my tests show contradictory results.
Let's say I call a component multiple times with
will the second useState() be reset to
{user: null}
then to {user: 'bar'}
or is useState smart enough to know it aleady has a value and to not reinstantiate itself ?23 replies