-
Notifications
You must be signed in to change notification settings - Fork 27.3k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
router.push() progress bar #45499
Comments
You can play an animation on the const router = useRouter()
useEffect(() => {
router.events.on('routeChangeStart', routeChangeStart);
router.events.on('routeChangeComplete', routeChangeEnd);
router.events.on('routeChangeError', routeChangeError);
return () => {
router.events.off('routeChangeStart', routeChangeStart);
router.events.off('routeChangeComplete', routeChangeEnd);
router.events.off('routeChangeError', routeChangeError);
};
}, []); This is how this library is doing actually: https://github.com/apal21/nextjs-progressbar/blob/master/src/index.tsx Do you think something else is needed or you can just use the router events? |
It does not work with next13. |
I am curious if there is a way to use Suspense to achieve this. Not sure what the requirements are for your use case but I could see if you had 3 requests for example, updating the progress of a loader component as each request comes back. |
Bumping the issue. The new useRouter from Next 13 'next/navigation' (AppRouterInstance) doesn't expose any properties to detect the events on routes. Any possible solution? |
I think they'll eventually add these events again, just a matter of time. One PR is open to listen to routeChangeStart: |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the feature you'd like to request
A progress bar which shows the progress while loading a new page.
It's a little strange to use useRouter and have no indication that the new page is going to load.
Describe the solution you'd like
Something like https://www.npmjs.com/package/nextjs-progressbar
It was great.
Describe alternatives you've considered
Currently in next Js 13 unfortunately I've found no alternatives
The text was updated successfully, but these errors were encountered: