Skip to content

Render Next.js client-side tests with use(browser()) - #963

Merged
AlexanderKaran merged 1 commit into
e18e:mainfrom
icyJoseph:next-csr-use-browser
Nov 27, 2026
Merged

AlexanderKaran merged 1 commit into
e18e:mainfrom
icyJoseph:next-csr-use-browser

Conversation

@icyJoseph

Copy link
Copy Markdown
Contributor

This test measures rendering in the browser. The Next.js routes used next/dynamic with ssr: false, which does more than skip server rendering. It also splits the component into its own chunk that the browser requests after the page's JavaScript runs, and the component suspends while that loads. React batches reveals of suspended content, so the table then waits for the next batch.

React's use(browser()) inside a Suspense boundary renders a component only in the browser, which is what this test asks for. The Next.js docs already describe it, after next/dynamic. vercel/next.js#102401 updates that section to lead with it. The server HTML still contains no table or detail content, and nothing suspends in the browser.

Local runs on Next.js 16.4.6, 5 runs each: First Paint / FCP 346ms → 83ms. Interaction latency is unchanged within noise.

Methodology updated to describe the new setup.

Checklist

  • If updating UI/UX components ensure you have added screenshots or a gif or video of the changes to the PR description
  • If this is a dependabot PR that bumps a metaframework version, ensure that all package versions in the package match the versions installed by the metaframework version being bumped
  • If this is a dependabot PR that bumps a metaframework version in a starter-* package, ensure that the deps, and file content matches the output of the metaframeworks recommended starter/default project

@AlexanderKaran

Copy link
Copy Markdown
Collaborator

Hi @icyJoseph

Thank you for this PR.

I brought this up with @timneutkens after this PR: #929

I'm just waiting for him to get back to me and confirm.

In what version of NextJS did this become the approved method to do CSR?

@icyJoseph

Copy link
Copy Markdown
Contributor Author

Hi — yeah we were talking about this. browser() is rather recent for React, it landed on react@19.3 as stable.

In Next.js the earliest minor release would be 16.4.0.

@icyJoseph
icyJoseph marked this pull request as ready for review November 26, 2026 15:35
@AlexanderKaran

Copy link
Copy Markdown
Collaborator

@icyJoseph, thank you. Let me compare versions before I review and merge this then to check if I have to re-run anything.

@AlexanderKaran

Copy link
Copy Markdown
Collaborator

All good, we are on "next": "16.4.6", so this is for the latest minor so no re-running needed.

@AlexanderKaran

Copy link
Copy Markdown
Collaborator

@icyJoseph Can I ask did this whole thing trigger the PR change in your docs?

@AlexanderKaran
AlexanderKaran merged commit 494b5fa into e18e:main Nov 27, 2026
121 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants