Skip to content

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

Merged
eps1lon merged 2 commits intofacebook:mainfrom
eps1lon:sebbie/se-hydration
Apr 17, 2026
Merged

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

Conversation

@eps1lon
Copy link
Copy Markdown
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
Copy Markdown

react-sizebot commented Mar 5, 2026

Comparing: 23fcd7c...7bf5644

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.11% 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 612.91 kB 612.93 kB = 108.30 kB 108.31 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB +0.16% 1.88 kB 1.89 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 678.85 kB 678.86 kB = 119.27 kB 119.27 kB
facebook-www/ReactDOM-prod.classic.js = 698.58 kB 698.60 kB = 122.74 kB 122.74 kB
facebook-www/ReactDOM-prod.modern.js = 688.90 kB 688.92 kB = 121.12 kB 121.13 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 7bf5644

@eps1lon eps1lon force-pushed the sebbie/se-hydration branch 3 times, most recently 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
@eps1lon eps1lon force-pushed the sebbie/se-hydration branch from 8975211 to 7bf5644 Compare April 17, 2026 16:02
@eps1lon eps1lon merged commit 67e4759 into facebook:main Apr 17, 2026
235 checks passed
@eps1lon eps1lon deleted the sebbie/se-hydration branch April 17, 2026 16:10
github-actions Bot pushed a commit that referenced this pull request Apr 17, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 17, 2026
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.

4 participants