Skip to content

Commit

Permalink
Keep fouc tags for streaming (#35417)
Browse files Browse the repository at this point in the history
Basically the revert change of #31187

The fouc tag are rendered in first place, and the removing fouc tags script is executed before hydration which is early enough. This will unblock the dev mode of global CSS development

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
  • Loading branch information
huozhi committed Mar 18, 2022
1 parent 757a0c7 commit 279f47b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions packages/next/pages/_document.tsx
Expand Up @@ -585,11 +585,8 @@ export class Head extends Component<
disableOptimizedLoading,
optimizeCss,
optimizeFonts,
runtime,
} = this.context

const hasConcurrentFeatures = !!runtime

const disableRuntimeJS = unstable_runtimeJS === false
const disableJsPreload =
unstable_JsPreload === false || !disableOptimizedLoading
Expand Down Expand Up @@ -702,7 +699,7 @@ export class Head extends Component<

return (
<head {...this.props}>
{!hasConcurrentFeatures && this.context.isDevelopment && (
{this.context.isDevelopment && (
<>
<style
data-next-hide-fouc
Expand Down
Expand Up @@ -16,8 +16,8 @@ export default function (context) {
)
expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`)
})
// TODO: fix this test
it.skip('should include css modules with `serverComponents: true`', async () => {

it('should include css modules with `serverComponents: true`', async () => {
const browser = await webdriver(context.appPort, '/css-modules')
const currentColor = await browser.eval(
`window.getComputedStyle(document.querySelector('h1')).color`
Expand Down

0 comments on commit 279f47b

Please sign in to comment.