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

Stop delay option to avoid progress bar flash #46

Closed njarraud closed 5 months ago

njarraud commented 6 months ago

In some cases, having the progress bar being displayed up to 100% even if the page loads instantly would be a great option. It currently vanishes after a few ms at the start of the animation which doesn't look great unless you set the delay option which removes it all together.

This was available in nextjs-progressbar as stopDelayMs.

if (!shallow || showOnShallow) {
      if (timer) clearTimeout(timer);
      timer = setTimeout(() => {
        NProgress.done(true);
      }, stopDelayMs);
}
Skyleen77 commented 6 months ago

You now have a stopDelay parameter on the last version (2.3.8). Tell me if it's good for you.

njarraud commented 6 months ago

There is a bug sometimes when using this new stopDelay property. The progress bar flashes once quickly and then reappears again to last for the duration of the stopDelayvalue. Or even flashes 2 short times with a time interval.

Skyleen77 commented 6 months ago

Sure enough, I fixed that. I've done a lot of testing and it seems to be good now. Please upgrade to version 2.3.9 and confirm that it works well.

Thanks

njarraud commented 6 months ago

Still the same issues with flashing when the stopDelay param is used.

Skyleen77 commented 6 months ago

Could you send me a codesandox with the bug ?