mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 19:57:25 +02:00
fix(v2): make correct internal link check
This commit is contained in:
parent
d099bd2ee8
commit
c2aeda273c
1 changed files with 2 additions and 2 deletions
|
@ -12,7 +12,7 @@ import isInternalUrl from '@docusaurus/utils';
|
||||||
function Link(props) {
|
function Link(props) {
|
||||||
const {to, href} = props;
|
const {to, href} = props;
|
||||||
const targetLink = to || href;
|
const targetLink = to || href;
|
||||||
const isInternal = isInternalUrl;
|
const isInternal = isInternalUrl(targetLink);
|
||||||
const preloaded = useRef(false);
|
const preloaded = useRef(false);
|
||||||
|
|
||||||
const IOSupported =
|
const IOSupported =
|
||||||
|
@ -66,7 +66,7 @@ function Link(props) {
|
||||||
};
|
};
|
||||||
}, [targetLink, IOSupported, isInternal]);
|
}, [targetLink, IOSupported, isInternal]);
|
||||||
|
|
||||||
return !targetLink || !isInternal(targetLink) ? (
|
return !targetLink || !isInternal ? (
|
||||||
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
||||||
<a {...props} href={targetLink} />
|
<a {...props} href={targetLink} />
|
||||||
) : (
|
) : (
|
||||||
|
|
Loading…
Add table
Reference in a new issue