Skip to content

Commit

Permalink
Exclude external links from triggering progress bar (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
portdeveloper committed Aug 15, 2024
1 parent 8c2f4ec commit 0e18439
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/nextjs/components/scaffold-eth/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ export function ProgressBar() {
NProgress.configure({ showSpinner: false });

const handleAnchorClick = (event: MouseEvent) => {
const targetUrl = (event.currentTarget as HTMLAnchorElement).href;
const anchor = event.currentTarget as HTMLAnchorElement;
const targetUrl = anchor.href;
const currentUrl = location.href;
if (targetUrl !== currentUrl) {
NProgress.start();
}
const isTargetBlank = anchor?.target === "_blank";
if (targetUrl === currentUrl || isTargetBlank) return;
NProgress.start();
};

const handleMutation: MutationCallback = () => {
Expand Down

0 comments on commit 0e18439

Please sign in to comment.