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
How it is setup now is using await navigateTo which shows a 404 page that doesn't represent error.vue. I expect it to navigate away. When I use return navigateTo then I get a 500 page that says: Vite Error, but don't see an error anywhere.
Describe the bug
It seems like using navigateTo in error.vue doesn't work for navigating the user away. I want to use this so that I can redirect a user when there is a 404 and a specific URL is being requested (redirects can be specified in a CMS). When I take a look at the docs this is supposed to work? https://v3.nuxtjs.org/api/utils/navigate-to#navigating-within-a-vue-component.
Additional context
At the moment I can make it work if I put the call to navigateTo in the onMounted function, but this doesn't seem the right approach to me as I want to redirect as soon as possible on the server. Now you see a small flash of the 404 page before the redirection happens.
I also tried the following in an error.ts file in the plugins folder:
Environment
v16.15.1
3.0.0-rc.9
0.5.1
vite
Reproduction
Simple reproduction on Stackblitz: https://stackblitz.com/edit/github-2ty5wn?file=error.vue
How it is setup now is using
await navigateTo
which shows a 404 page that doesn't representerror.vue
. I expect it to navigate away. When I usereturn navigateTo
then I get a 500 page that says:Vite Error
, but don't see an error anywhere.Describe the bug
It seems like using
navigateTo
inerror.vue
doesn't work for navigating the user away. I want to use this so that I can redirect a user when there is a 404 and a specific URL is being requested (redirects can be specified in a CMS). When I take a look at the docs this is supposed to work? https://v3.nuxtjs.org/api/utils/navigate-to#navigating-within-a-vue-component.Additional context
At the moment I can make it work if I put the call to
navigateTo
in theonMounted
function, but this doesn't seem the right approach to me as I want to redirect as soon as possible on the server. Now you see a small flash of the 404 page before the redirection happens.I also tried the following in an
error.ts
file in theplugins
folder:That makes the URL change in the browser, but the app stays on the error page of
error.vue
.Logs
No response
The text was updated successfully, but these errors were encountered: