-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loader completes prematurely if middleware returns a redirect #2563
Comments
It should be a expected behavior in So if middleware is export default function ({ redirect, route }) {
console.log(route.fullPath)
redirect('/')
} Printed two lines: If your behavior is not same like above, could you please provide a repo can reproduce the issue? |
Thanks for the fast response @clarkdo I think I may not have explained well or have misunderstood the answer. The middleware is executed twice, that's all fine. The issue is the loading bar. It stops after the first request and does not start again. So once the middleware calls redirect, the default loading bar finishes instead of starting again for the redirected route. |
I just pushed a fix about it (e33d502), we will release a new version of Nuxt.js next week. It also handle when a redirect is to himself or to another page :) |
That's awesome, thanks @Atinux - you rock! |
@silverbackdan I just pushed |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
It appears that if I return a redirect from router middleware, the loader completes, instead of continuing while the page that is being redirected to loads and that routes middleware are executed.
Please let me know if you'd like a repro. Cheers.
The text was updated successfully, but these errors were encountered: