Next.js Discord

Discord Forum

Intending to trigger a progress bar, does not work when target link is the same as current link

Unanswered
Morelet’s Crocodile posted this in #help-forum
Open in Discord
Avatar
Morelet’s CrocodileOP
from ./src/app/page.js

"use client";

import Link from "next/link";
import styles from "./page.module.css";
import { AppProgressBar as ProgressBar } from "next-nprogress-bar";

export default function Home() {
  return (
    <>
      <div className={styles.header}>
        <a href="/">
          <p>Home</p>
        </a>
        <a href="/about">
          <p>About</p>
        </a>
        <a href="/contact-us">
          <p>Contact Us</p>
        </a>
        <ProgressBar 
            height="4px"
            color="#46e640"
            options={{ showSpinner: false }} 
            disableSameURL={false}
        />
      </div>
    </>
  );
}


I am currently using a package called next-nprogress-bar, however when I try to navigate to the Home Page while currently on there, the progress bar does not load fully and does not complete. Clicking on other Links, however, loads the progress bar properly. Anyone know how to fix this?

1 Reply

Avatar
Julienng
Hi! Sam Selikoff has a great blog post about nprogress in Nextjs, you might find this informative:
https://buildui.com/posts/global-progress-in-nextjs