Skip to content

fix: infinity load when in new tab #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/* eslint-disable prefer-const */
/* eslint-disable quotes */

"use client"

import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as NProgress from 'nprogress';
Expand Down Expand Up @@ -227,6 +229,7 @@ const NextTopLoader = ({
const target = event.target as HTMLElement;
const anchor = findClosestAnchor(target);
const newUrl = anchor?.href;
const isNewTab = event.ctrlKey || event.metaKey;
if (newUrl) {
const currentUrl = window.location.href;
// const newUrl = (anchor as HTMLAnchorElement).href;
Expand All @@ -249,6 +252,7 @@ const NextTopLoader = ({
isSpecialScheme ||
event.ctrlKey ||
event.metaKey ||
isNewTab
event.shiftKey ||
event.altKey ||
isHashAnchor(window.location.href, anchor.href) ||
Expand Down