Skip to content

[Fiber] Double invoke Effects in Strict Mode during Hydration#35961

Open
eps1lon wants to merge 2 commits intofacebook:mainfrom
eps1lon:sebbie/se-hydration
Open

[Fiber] Double invoke Effects in Strict Mode during Hydration#35961
eps1lon wants to merge 2 commits intofacebook:mainfrom
eps1lon:sebbie/se-hydration

Conversation

@eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Mar 5, 2026

Summary

Also reported in vercel/next.js#66210

Not double invoking during Hydration was on oversight. Double invoking during Hydration ensures parity between hydrateRoot and createRoot.

Double invoking an Effect is tracked with PlacementDEV. This was always used together with Placement. However, during hydration we don't track side-effects i.e. set no Placement flag causing no double invocation of Effects in Strict Mode.

Now we set PlacementDEV when we set the Hydration flag to double invoke Effects in Strict Mode when we hydrated which is conceptually like a Placement during client-render.

How did you test this change?

  • Added test (see first commit for previous behavior)
  • Added a regression test for Activity which didn't change in behavior

@meta-cla meta-cla bot added the CLA Signed label Mar 5, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Mar 5, 2026
@react-sizebot
Copy link

react-sizebot commented Mar 5, 2026

Comparing: 93882bd...8975211

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB +0.05% 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 611.79 kB 611.80 kB = 108.12 kB 108.12 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 677.72 kB 677.73 kB = 119.08 kB 119.08 kB
facebook-www/ReactDOM-prod.classic.js = 697.67 kB 697.68 kB = 122.58 kB 122.59 kB
facebook-www/ReactDOM-prod.modern.js = 687.98 kB 688.00 kB = 120.96 kB 120.97 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 8975211

@eps1lon eps1lon force-pushed the sebbie/se-hydration branch 2 times, most recently from 64740e0 to be46b22 Compare March 5, 2026 08:38
@eps1lon eps1lon force-pushed the sebbie/se-hydration branch from be46b22 to 8975211 Compare March 5, 2026 08:53
@eps1lon eps1lon marked this pull request as ready for review March 5, 2026 08:59
@eps1lon eps1lon requested a review from acdlite March 5, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants