Skyleen77 / next-nprogress-bar

NProgress integration on Next.js compatible with /app and /pages folders

Home Page:https://next-nprogress-bar.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

router.replace() not triggering progress bar

mamlzy opened this issue · comments

Hi thanks for this library, I think this library not implementing progress bar yet for the replace method? but push & back already implemented here. am i correct?

image

yepp, came here to say the same

meanwhile you can easily wrap it yourself with something like:

  const router = useNextRouter()

  const replace = React.useCallback(
    (
      href: string,
      options?: NavigateOptions | undefined,
      NProgressOptions?: NProgressOptions,
    ) => {
      if (NProgressOptions?.showProgressBar !== false) {
        NProgress.start()
      }

      return router.replace(href, options)
    },
    [router],
  )

This will be added in the next version which is coming soon.

This will be added in the next version which is coming soon.

glad to hear that! I think you could close the issue after the feature is added