Prompt-Engineering-Guide icon indicating copy to clipboard operation
Prompt-Engineering-Guide copied to clipboard

fix: Elimination of unnecessary space

Open silverskyvicto opened this issue 5 months ago • 1 comments

A warning is displayed when multiple nodes are passed even though only one node can be under a <title> tag.

Warning: A title element received an array with more than 1 element as children. In browsers title Elements can only have Text Nodes as children. If the children being rendered output more than a single text node in aggregate the browser will display markup and comments as text in the title and hydration will likely fail and fall back to client rendering
    at title
    at head
    at Head (webpack-internal:///./node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/pages/_document.js:258:1)
    at html
    at Html (webpack-internal:///./node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/pages/_document.js:676:132)
    at Document (webpack-internal:///./node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/pages/_document.js:692:1)

ref: https://github.com/vercel/next.js/discussions/38256

If there is an extra blank space at the end of the title, it is assumed to be recognized as a separate node. By removing the blank space, this error no longer appears.

silverskyvicto avatar Sep 03 '24 04:09 silverskyvicto