apal21 / nextjs-progressbar

A simple Next.js progressbar component using NProgress.

Home Page:https://www.npmjs.com/package/nextjs-progressbar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request for nprogress.start() and nprogress.done() Functions to be Added to nextjs-progressbar

in-ch opened this issue · comments

I implemented an onClick event function that allows the <Link> component to display a confirmation modal whenever the page is moved as follows.

e.preventDefault();

handleShowModal(
    commonModal({
          title: 'title',
          description: 'description',
          handleClickClose: () => {
             handleHideModal();
             NProgress.done(true);
          },
          handleClickOk: () => {
            router.replace(`${href}`);
          },
    }),
);

The issue I'm facing is that NProgress starts appearing at the top before e.preventDefault() gets executed due to <Link> component. To resolve this, I had to install nprogress and @types/nprogress additionally, which I find less than ideal.

Is it possible that nextjs-progressbar, which already includes nprogress as a dependency, supports nprogress.start() and nprogress.done() functionalities?

I'm curious if it could handle this without the need for additional installations, similar to how it's done locally.