Skyleen77 / next-nprogress-bar

NProgress integration on Next.js compatible with /app and /pages folders
https://next-nprogress-bar.vercel.app
315 stars 24 forks source link

Flag to disable anchor link handlers from being attached #60

Closed osdiab closed 4 months ago

osdiab commented 4 months ago

Based on top of #59

Adds a flag to the progress bar that allows you to disable the anchor click handlers.

TODO

In my case, I am using this workaround from a NextJS discussion where one monkey-patches the app router implementation to allow for blocking navigation.

But since this library just adds event handlers to every link, while page transitions do properly get blocked, the progress bar starts regardless and then just runs forever.

So I combined the above code with a context/provider to register when navigation has been intercepted; and then based on the intercept status, disable the anchor bindings for nprogress. This way, it all works and no issues with mystery progress bars.

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-nprogress-bar ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2024 2:30am