Skip to content

Commit bb1f490

Browse files
authored
Disable failed scroll restoration warning (vercel#74875)
We already know all the cases where we currently fail to restore scroll (vercel#74751). Users cannot work around this warning so it's pure noise.
1 parent d0d7352 commit bb1f490

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/next/src/client/components/layout-router.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ class InnerScrollAndFocusHandler extends React.Component<ScrollAndFocusHandlerPr
217217
while (!(domNode instanceof HTMLElement) || shouldSkipElement(domNode)) {
218218
if (process.env.NODE_ENV !== 'production') {
219219
if (domNode.parentElement?.localName === 'head') {
220-
console.error(
221-
'Tried to scroll to a head element. This is a bug in Next.js.'
222-
)
220+
// TODO: We enter this state when metadata was rendered as part of the page or via Next.js.
221+
// This is always a bug in Next.js and caused by React hoisting metadata.
222+
// We need to replace `findDOMNode` in favor of Fragment Refs (when available) so that we can skip over metadata.
223223
}
224224
}
225225

0 commit comments

Comments
 (0)