fix onClick vs legacyBehavior

adds missing legacyBehavior attribute to NextLink tags to prevent nesting anchor elements which was causing hydration warnings. Also fixes 'The legacy behavior requires onClick be set on the child of next/link'
This commit is contained in:
Paul Wackerow 2022-12-12 12:01:20 -08:00
parent 5f9daa4286
commit 1483d10a12
No known key found for this signature in database
GPG Key ID: BB63E296FE9CAB8D
2 changed files with 4 additions and 4 deletions

View File

@ -53,8 +53,8 @@ export const DocsLinks: FC<Props> = ({ navLinks, toggleMobileAccordion }) => {
_groupHover={{ background: 'primary', color: 'bg', textDecoration: 'none' }} _groupHover={{ background: 'primary', color: 'bg', textDecoration: 'none' }}
> >
{to ? ( {to ? (
<NextLink href={to} passHref onClick={toggleMobileAccordion}> <NextLink href={to} passHref legacyBehavior>
<Link textDecoration='none !important'> <Link textDecoration='none !important' onClick={toggleMobileAccordion}>
<Text <Text
textStyle='docs-nav-dropdown' textStyle='docs-nav-dropdown'
color={isActive ? 'primary' : 'unset'} color={isActive ? 'primary' : 'unset'}

View File

@ -25,8 +25,8 @@ export const LinksList: FC<LinksListProps> = ({ links, toggleMobileAccordion })
_hover={{ background: 'primary', color: 'bg' }} _hover={{ background: 'primary', color: 'bg' }}
data-group data-group
> >
<NextLink href={to} passHref key={id} onClick={toggleMobileAccordion} legacyBehavior> <NextLink href={to} passHref key={id} legacyBehavior>
<Link textDecoration='none !important'> <Link textDecoration='none !important' onClick={toggleMobileAccordion}>
<Text <Text
textStyle='docs-nav-links' textStyle='docs-nav-links'
color={items || isActive ? 'primary' : 'body'} color={items || isActive ? 'primary' : 'body'}