482fccb922
### Update
We removed the `<head>` element checking for root layout in #41621. Since we also need `<head>` for preload in the future, and also css-in-js will require that. We're adding back the `head` element checking to make sure user always provide valid root layout including it.
### Issue
An issue was reported [here](https://github.com/mui/material-ui/issues/34905#issuecomment-1331945868) that the Emotion/MUI site was suffering from FOUC.
After an inspection, I noticed that the SSRed HTML didn't contain the inserted styles at all - despite them being inserted through `useServerInsertedHTML`. I managed to debug it down and discovered that their layout was missing `<head></head>` and thus the stream transformer skipped the insertion altogether cause of this check:
|
||
---|---|---|
.. | ||
react-dev-overlay | ||
app-router-headers.ts | ||
app-router.tsx | ||
dynamic.tsx | ||
error-boundary.tsx | ||
error.tsx | ||
headers.ts | ||
hooks-server-context.ts | ||
infinite-promise.ts | ||
layout-router.tsx | ||
match-segments.ts | ||
navigation.ts | ||
not-found.ts | ||
redirect.ts | ||
reducer.ts | ||
render-from-template-context.tsx | ||
request-async-storage.ts | ||
static-generation-async-storage.ts | ||
static-generation-bailout.ts | ||
use-reducer-with-devtools.ts |