https://codesandbox.io/s/40y7x1l0p4
https://40y7x1l0p4.sse.codesandbox.io/randome_string
Inside the console the String test
should only exist once.
The string test
will be shown twice.
I just added a middleware that redirects to the test page if it is not in the router array:
export default ({ app, route, redirect }) => {
const { path, query } = route;
const { routes } = app.router.options;
// Other redirects
if (routes.find(value => value.path === path) === undefined) {
return redirect("/test");
}
};
Inside the test page i only output test
on the mounted event.
This only occure when the nuxt mode is set to spa
I have a same issue
asyncadata/fetch trigger only once in this case.
mounted and created twice. so component got created twice for some reason
Happens in production mode too
I can also confirm this bug. If I wrap the redirect in a setTimeout(() => redirect()) it fixes the bug. But this is definitely a bug and a serious on eat that.
Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:
Issues that are labeled as 馃晲Pending
will not be automatically marked as stale.
Dam Automatic bot. It's still relevant in v2.3.4. Please reopen this.
Because there is no response from the nuxt team i opened a new ticket for it: https://github.com/nuxt/nuxt.js/issues/4757
Most helpful comment
Dam Automatic bot. It's still relevant in v2.3.4. Please reopen this.