Skip to content

App router: Content flickering with React.createContext and next/dynamic for SSG/SSR #64060

@KirillEvtushenko

Description

@KirillEvtushenko

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/interesting-aryabhata-ckyy6f

To Reproduce

  1. Refresh the page
  2. Notice that the right block with Client component and RSC inside noticeably flickers

Current vs. Expected behavior

When using next/dynamic with React.createContext, I expect that it will work the same way as without React.createContext.
Please pay attention that initial request with html correctly contains all the needed html. Provider's rerender (recreating of the value object prop) then causes that flickering.

issue.mov

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:43 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6000
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.18
  pnpm: 8.6.5
Relevant Packages:
  next: 14.1.4
  eslint-config-next: 13.5.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

App Router, Dynamic imports (next/dynamic)

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), Vercel (Deployed), Other (Deployed)

Additional context

No response

NEXT-3074

Metadata

Metadata

Assignees

No one assigned

    Labels

    Lazy LoadingRelated to Next.js Lazy Loading (e.g., next/dynamic or React.lazy).bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.locked

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions