basic-ph
useFetch and lazy option
Data fetching docs (https://nuxt.com/docs/getting-started/data-fetching#lazy) say:
By default, data fetching composables will wait for the resolution of their asynchronous function before navigating to a new page by using Vue’s Suspense. This feature can be ignored on client-side navigation with the lazy option. In that case, you will have to manually handle loading state using the pending value.When I use
useFetch
like this:
should I expect a 3 seconds wait before navigation to the page containing this code?
I feel like I'm missing some piece of the puzzle here
I've created a simple example of this behaviours:
https://stackblitz.com/edit/github-7hutqh18 replies
500 Infinite redirect in navigation guard
Hello guys, I'm struggling with a global middleware I created to handle some 301 redirects. I've simplified the structure to debug it and I got to this point:
In order to reproduce the issue I followed exactly these steps:
-
npx nuxi init demo
- cd demo
- yarn install
(Nuxt 3.4.1)
- created middleware
directory and moved the redirects.global.ts
file to it
- created pages
directory and added index.vue
and about.vue
- yarn dev
- open the following url in your browser: http://localhost:3000/old
=> "500 Infinite redirect in navigation guard"
Other routes work fine, but when the middleware return navigateTo('something')
something goes wrong.
Any idea? Am I missing something about the logical working of a middleware?4 replies
`process.server` and `process.client`
Hello everyone!
Disclaimer: Maybe this is a trivial question but I have not been able to find an answer in the documentation or elsewhere on the web.
I was wondering where the
process.server
and process.client
syntax used in this example came from: https://github.com/nuxt/nuxt/blob/main/examples/other/locale/composables/locale.ts#L7-L135 replies