Skip to content
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

Fix: wrong link error message #28127

Merged
merged 2 commits into from Aug 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/client/link.tsx
Expand Up @@ -237,7 +237,7 @@ function Link(props: React.PropsWithChildren<LinkProps>) {
throw new Error(
`Multiple children were passed to <Link> with \`href\` of \`${props.href}\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children` +
(typeof window !== 'undefined'
? "\nOpen your browser's console to view the Component stack trace."
? " \nOpen your browser's console to view the Component stack trace."
: '')
)
}
Expand Down
10 changes: 10 additions & 0 deletions test/acceptance/ReactRefreshLogBox.dev.test.js
Expand Up @@ -1130,6 +1130,16 @@ test('<Link> with multiple children', async () => {
expect(await session.getRedboxDescription()).toMatchInlineSnapshot(
`"Error: Multiple children were passed to <Link> with \`href\` of \`/\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children"`
)
expect(
await session.evaluate(
() =>
document
.querySelector('body > nextjs-portal')
.shadowRoot.querySelector(
'#nextjs__container_errors_desc a:nth-of-type(1)'
).href
)
).toMatch('https://nextjs.org/docs/messages/link-multiple-children')

await cleanup()
})
Expand Down