You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run next info (available from version 12.0.8 and up)
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
Binaries:
Node: 16.0.0
npm: 7.10.0
Yarn: 1.22.11
pnpm: N/A
Relevant packages:
next: 12.0.8
react: 18.0.0-rc.0
react-dom: 18.0.0-rc.0
What version of Next.js are you using?
12.0.8
What version of Node.js are you using?
16.0.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
Document renders before application renders when streaming is turned on (i.e. concurrentFeatures flag is set to true), so it builds the <head> tag before next/head instances are discovered in the component tree. As a result, next/head tags are not in the <head> of the initial SSR response and only are added to <head> once the component tree renders on the client side. This is an invisible performance regression if there are resource tags in next/head, since it appears to work but the tags load much later in the process.
Application should render before the Document so next/head instances are discovered before the <head> tag is built. This would prevent the performance regression.
To Reproduce
Have a component that uses next/head (no Suspense boundaries):
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Run
next info
(available from version 12.0.8 and up)Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
Binaries:
Node: 16.0.0
npm: 7.10.0
Yarn: 1.22.11
pnpm: N/A
Relevant packages:
next: 12.0.8
react: 18.0.0-rc.0
react-dom: 18.0.0-rc.0
What version of Next.js are you using?
12.0.8
What version of Node.js are you using?
16.0.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
Document renders before application renders when streaming is turned on (i.e. concurrentFeatures flag is set to true), so it builds the
<head>
tag before next/head instances are discovered in the component tree. As a result, next/head tags are not in the<head>
of the initial SSR response and only are added to<head>
once the component tree renders on the client side. This is an invisible performance regression if there are resource tags in next/head, since it appears to work but the tags load much later in the process.cc @shuding @huozhi @devknoll
Expected Behavior
Application should render before the Document so next/head instances are discovered before the
<head>
tag is built. This would prevent the performance regression.To Reproduce
concurrentFeatures
flag<head>
tagThe text was updated successfully, but these errors were encountered: