fix(v2): make correct internal link check

This commit is contained in:
Alexey Pyltsyn 2020-01-07 13:25:15 +03:00
parent d099bd2ee8
commit c2aeda273c

View file

@ -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} />
) : ( ) : (