GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Double Invoke Effects in __DEV__ by lunaruan · Pull Request #19523 · react/react

Conversation

@lunaruan

@lunaruan lunaruan commented Aug 4, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR double invokes effects in __DEV__ mode.

We are thinking about unmounting layout and/or passive effects for a hidden tree. To understand potential issues with this, we want to double invoke effects. This PR changes the behavior in DEV when an effect runs from create() to create() -> destroy() -> create(). The effect cleanup function will still be called before the effect runs in both dev and prod. (Note: This change is purely for research for now as it is likely to break real code.)

Note: The change is fully behind a flag and does not affect any of the code on npm.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

NE-SmallTown reacted with thumbs up emoji rickhanlonii reacted with hooray emoji
All reactions
  • 👍 1 reaction
  • 🎉 1 reaction
@lunaruan
lunaruan requested review from acdlite, bvaughn and sebmarkbage August 4, 2020 04:26
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Aug 4, 2020
@codesandbox-ci

codesandbox-ci Bot commented Aug 4, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b9b5750:

Sandbox Source
React Configuration
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lunaruan
lunaruan force-pushed the double_invoke branch from c927a2c to 4e14498 Compare August 4, 2020 07:02
@sizebot

sizebot commented Aug 4, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Details of bundled changes.

Comparing: a99bf5c...b9b5750

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js 0.0% 0.0% 872.83 KB 872.83 KB 199.89 KB 199.9 KB NODE_DEV
ReactDOMForked-prod.js 0.0% 0.0% 386.13 KB 386.14 KB 71.33 KB 71.33 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 137.06 KB 137.06 KB 36.37 KB 36.37 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 117.72 KB 117.72 KB 38.02 KB 38.03 KB NODE_PROD
ReactDOMForked-profiling.js 0.0% 0.0% 400.17 KB 400.18 KB 73.73 KB 73.73 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 143.14 KB 143.14 KB 36.57 KB 36.57 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.2 KB 20.2 KB 7.58 KB 7.58 KB NODE_PROD
ReactDOMTesting-dev.js 0.0% 0.0% 940.45 KB 940.45 KB 210.76 KB 210.76 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 65.05 KB 65.05 KB 18.62 KB 18.62 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% 0.0% 385.05 KB 385.05 KB 72.38 KB 72.38 KB FB_WWW_PROD
react-dom-test-utils.production.min.js 0.0% -0.0% 13.58 KB 13.58 KB 5.21 KB 5.21 KB NODE_PROD
ReactTestUtils-dev.js +0.1% +0.1% 59.7 KB 59.78 KB 16.56 KB 16.57 KB FB_WWW_DEV
react-dom.development.js 0.0% 0.0% 917.24 KB 917.24 KB 202.43 KB 202.43 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 117.62 KB 117.62 KB 38.71 KB 38.71 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 121.51 KB 121.51 KB 39.92 KB 39.92 KB UMD_PROFILING
ReactDOMForked-dev.js +0.6% +0.4% 988.64 KB 994.78 KB 219.16 KB 219.99 KB FB_WWW_DEV
react-dom.profiling.min.js 0.0% 0.0% 121.79 KB 121.79 KB 39.22 KB 39.22 KB NODE_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 19.88 KB 19.88 KB 7.46 KB 7.46 KB UMD_PROD
ReactDOM-dev.js 0.0% 0.0% 986.84 KB 986.92 KB 219.32 KB 219.34 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 0.0% 385.83 KB 385.83 KB 71.1 KB 71.1 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% 0.0% 135.79 KB 135.79 KB 36.12 KB 36.12 KB NODE_DEV
ReactDOM-profiling.js 0.0% 0.0% 399.04 KB 399.04 KB 73.53 KB 73.53 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 19.78 KB 19.78 KB 7.42 KB 7.42 KB NODE_PROD
ReactDOMServer-dev.js +0.1% +0.1% 145.53 KB 145.61 KB 37.29 KB 37.31 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 70.21 KB 70.21 KB 19.11 KB 19.11 KB UMD_DEV

Size changes (stable)

Generated by 🚫 dangerJS against b9b5750

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sizebot

sizebot commented Aug 4, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Details of bundled changes.

Comparing: a99bf5c...b9b5750

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js 0.0% 0.0% 908.28 KB 908.28 KB 206.4 KB 206.4 KB NODE_DEV
ReactDOMForked-prod.js 0.0% 0.0% 374.8 KB 374.81 KB 69.54 KB 69.54 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 138.57 KB 138.57 KB 36.58 KB 36.59 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 122.28 KB 122.28 KB 39.34 KB 39.34 KB NODE_PROD
ReactDOMForked-profiling.js 0.0% 0.0% 388.8 KB 388.81 KB 72 KB 72 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 144.73 KB 144.73 KB 36.77 KB 36.77 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.66 KB 20.66 KB 7.65 KB 7.65 KB NODE_PROD
ReactDOMTesting-dev.js 0.0% 0.0% 912.12 KB 912.12 KB 205.29 KB 205.29 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 65.06 KB 65.06 KB 18.63 KB 18.63 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 5.52 KB 5.52 KB 1.84 KB 1.84 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 13.59 KB 13.59 KB 5.22 KB 5.22 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 5.25 KB 5.25 KB 1.78 KB 1.78 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.3% 1.17 KB 1.17 KB 666 B 668 B NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.22 KB 1.22 KB 712 B 713 B UMD_PROD
ReactTestUtils-dev.js +0.1% +0.1% 59.7 KB 59.78 KB 16.56 KB 16.58 KB FB_WWW_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 4.78 KB 4.78 KB 1.68 KB 1.68 KB NODE_DEV
react-dom.development.js 0.0% 0.0% 954.43 KB 954.43 KB 209.01 KB 209.01 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.01 KB 1.01 KB 616 B 617 B NODE_PROD
react-dom.production.min.js 0.0% 0.0% 122.11 KB 122.11 KB 40.09 KB 40.09 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 127.36 KB 127.36 KB 41.76 KB 41.76 KB UMD_PROFILING
ReactDOMForked-dev.js +0.6% +0.4% 963.06 KB 969.19 KB 214.44 KB 215.27 KB FB_WWW_DEV
react-dom.profiling.min.js 0.0% 0.0% 127.72 KB 127.72 KB 41.01 KB 41.02 KB NODE_PROFILING
ReactDOM-dev.js 0.0% 0.0% 961.26 KB 961.34 KB 214.66 KB 214.67 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% -0.0% 374.58 KB 374.58 KB 69.39 KB 69.39 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% 0.0% 137.3 KB 137.3 KB 36.33 KB 36.33 KB NODE_DEV
ReactDOM-profiling.js 0.0% 0.0% 387.74 KB 387.74 KB 71.82 KB 71.83 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 20.24 KB 20.24 KB 7.5 KB 7.5 KB NODE_PROD
ReactDOMServer-dev.js +0.1% +0.1% 141.5 KB 141.58 KB 36.28 KB 36.3 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 46.44 KB 46.44 KB 10.83 KB 10.83 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 70.22 KB 70.22 KB 19.12 KB 19.12 KB UMD_DEV

Size changes (experimental)

Generated by 🚫 dangerJS against b9b5750

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bvaughn bvaughn self-assigned this Aug 4, 2020
bvaughn
bvaughn suggested changes Aug 4, 2020
View reviewed changes
Comment thread packages/react-reconciler/src/__tests__/ReactDoubleInvokeEvents-test.internal.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/react-reconciler/src/__tests__/ReactDoubleInvokeEvents-test.internal.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@oriSomething

oriSomething commented Aug 6, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

It can cause some issues. For example, in where I work we have a component that have this kind of effect:

React.useEffect(() => {
  navigator.clipboard.readText().then(/* …And content to state variable  */);
}, []);

Also some components that sends analytics / fetch some data, which will probably break many tests.

EDIT:
We don't have proper cleanups always (What I wanted to say in short)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bvaughn

bvaughn commented Aug 6, 2020

Copy link
Copy Markdown
Contributor

Also some components that sends analytics / fetch some data

I'm not sure if this is what you're saying, but you probably shouldn't be sending analytics in DEV mode (or you should be sending them somewhere different than production analytics).

As for your concern about testing, that's something I haven't thought much about. I can see where this might cause hassle.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@oriSomething

oriSomething commented Aug 6, 2020

Copy link
Copy Markdown

@bvaughn Well, the analytics is not about sending them. We have a logger of analytics (to browsers devtools console), so while developing we can make sure they logged in correct scenarios. If sometimes it called twice and sometimes once, we can't predict if analytics correct.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vkurchatkin

vkurchatkin commented Aug 6, 2020

Copy link
Copy Markdown

This looks like it might brake a lot of code. This changes implies that effects can only be used when they have very specific semantics: they should either be idempotent or reversible. Also it makes it a requirement to implement a cleanup even if it is never supposed to run.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gaearon

gaearon commented Aug 6, 2020

Copy link
Copy Markdown
Collaborator

The change is fully behind a flag and does not affect any of the code on npm. Indeed, it is likely to break some code, so we want to try it at FB to see how large the impact is. We appreciate your concern but researching this more is the whole point of this PR. Hope this makes sense.

vkurchatkin and bvaughn reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gaearon

gaearon commented Aug 6, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

I'll add though that [] effects are already invoked multiple times when you use Fast Refresh, for example. So it's a good idea to make things that truly must only happen once resistant to this, e.g. using a ref. Again, coming up with a specific guidance is still a part of the research. We need to balance the code that's already written with the tradeoffs of adding new valuable features.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lunaruan
lunaruan force-pushed the double_invoke branch 3 times, most recently from fe64e03 to e51e75b Compare August 12, 2020 23:28
@lunaruan

lunaruan commented Aug 12, 2020

Copy link
Copy Markdown
Contributor Author

Ready for review!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sebmarkbage
sebmarkbage suggested changes Aug 13, 2020
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberWorkLoop.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/react-reconciler/src/ReactFiberWorkLoop.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@lunaruan
lunaruan force-pushed the double_invoke branch from e51e75b to 8cee981 Compare August 13, 2020 16:53
bvaughn
bvaughn reviewed Aug 13, 2020
View reviewed changes
Comment thread packages/react-reconciler/src/__tests__/ReactDoubleInvokeEvents-test.internal.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/react-reconciler/src/__tests__/ReactDoubleInvokeEvents-test.internal.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@lunaruan
lunaruan force-pushed the double_invoke branch from 8cee981 to b4f716a Compare August 14, 2020 00:04
@lunaruan

lunaruan commented Aug 14, 2020

Copy link
Copy Markdown
Contributor Author

Updated the PR based on everyone's comments!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bvaughn
bvaughn reviewed Aug 14, 2020
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Outdated
let fiber = firstChild;
while (fiber !== null) {
if (fiber.child !== null) {
// Should we add a separate subtree tag for this?

@bvaughn bvaughn Aug 14, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this comment for? I'm not sure I understand it.

Is this pointing out the fact that we're going to end up traversing all of the subtree paths that have layout effects even if they're all updates and none of them are mounts? So we could add a DEV-only tag e.g. MountLayoutSubtreeTag or something.

Maybe we could add some additional clarification to the wording here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sebmarkbage and lunaruan reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

@lunaruan lunaruan Aug 22, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I wasn't sure how OK it was to add a subtree tag vs. just traversing extra in DEV since it takes extra bytes to add an extra subtreetag, and I know at least with effectTag, we don't seem to want to add too many. If it's in DEV though it makes sense that it's OK. Thanks for clarifying!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

sebmarkbage
sebmarkbage reviewed Aug 14, 2020
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

sebmarkbage
sebmarkbage reviewed Aug 14, 2020
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

sebmarkbage
sebmarkbage reviewed Aug 14, 2020
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Outdated
case ForwardRef:
case SimpleMemoComponent:
case Block: {
invokeGuardedCallback(

@sebmarkbage sebmarkbage Aug 14, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, after https://github.com/facebook/react/pull/19605/files this will be unnecessary since commitHookEffectListUnmount should be safe now.

It's an awkward inconsistency since the equivalent mount isn't safe. I don't know what the answer is.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lunaruan lunaruan Aug 22, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'll leave it as is for now for consistency and maybe do a separate PR to make everything more consistent (Will creating a safelyCallCreate function cause perf issues)?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Nov 8, 2024
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalai-edgio-astro-ssr-example#1479
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/edgio-astro-ssr-example#1128
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalailayer0-astro-ssr-example#1113
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalailayer0-astro-ssr-example#1114
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/edgio-astro-ssr-example#1129
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/edgio-astro-ssr-example#1130
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/layer0-astro-ssr-example#1116
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/layer0-astro-ssr-example#1117
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalai-edgio-astro-ssr-example#1481
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalai-edgio-astro-ssr-example#1482
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/layer0-astro-ssr-example#1121
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/layer0-astro-ssr-example#1122
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/edgio-astro-ssr-example#1134
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/edgio-astro-ssr-example#1135
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalailayer0-astro-ssr-example#1118
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalailayer0-astro-ssr-example#1119
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/layer0-astro-ssr-example#1126
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/layer0-astro-ssr-example#1127
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalailayer0-astro-ssr-example#1123
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalailayer0-astro-ssr-example#1124
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalai-edgio-astro-ssr-example#1486
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/crystalai-edgio-astro-ssr-example#1487
Open
[Snyk] Upgrade react from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/edgio-astro-ssr-example#1138
Open
[Snyk] Upgrade react-dom from 17.0.2 to 18.3.1 https-quantumblockchainai-atlassian-net/edgio-astro-ssr-example#1139
Open
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@lunaruan
offscreen double invoke effects (react#19523)
ab2b68f
This PR double invokes effects in __DEV__ mode.

We are thinking about unmounting layout and/or passive effects for a hidden tree. To understand potential issues with this, we want to double invoke effects. This PR changes the behavior in DEV when an effect runs from create() to create() -> destroy() -> create(). The effect cleanup function will still be called before the effect runs in both dev and prod. (Note: This change is purely for research for now as it is likely to break real code.)

**Note: The change is fully behind a flag and does not affect any of the code on npm.**
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
Brian Vaughn
Double Invoke Effects in __DEV__ (in old reconciler fork) (react#20415)
78d431d
We originally added a new DEV behavior of double-invoking effects during mount to our new reconciler fork in PRs react#19523 and react#19935 and later refined it to only affect modern roots in PR react#20028. This PR adds that behavior to the old reconciler fork with a small twist– the behavior applies to StrictMode subtrees, regardless of the root type.

This commit also adds a few additional tests that weren't in the original commits.
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
Brian Vaughn
Re-add "strict effects mode" for legacy roots only (react#20639)
7067406
This combines changes originally made in react#19523, react#20028, and react#20415 but with slightly different semantics: "strict effects" mode is enabled only for the experimental root APIs (never for legacy render, regardless of <StrictMode> usage). These semantics may change slightly in the future.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@lunaruan
offscreen double invoke effects (react#19523)
824b26b
This PR double invokes effects in __DEV__ mode.

We are thinking about unmounting layout and/or passive effects for a hidden tree. To understand potential issues with this, we want to double invoke effects. This PR changes the behavior in DEV when an effect runs from create() to create() -> destroy() -> create(). The effect cleanup function will still be called before the effect runs in both dev and prod. (Note: This change is purely for research for now as it is likely to break real code.)

**Note: The change is fully behind a flag and does not affect any of the code on npm.**
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
Brian Vaughn
Double Invoke Effects in __DEV__ (in old reconciler fork) (react#20415)
17fd45f
We originally added a new DEV behavior of double-invoking effects during mount to our new reconciler fork in PRs react#19523 and react#19935 and later refined it to only affect modern roots in PR react#20028. This PR adds that behavior to the old reconciler fork with a small twist– the behavior applies to StrictMode subtrees, regardless of the root type.

This commit also adds a few additional tests that weren't in the original commits.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
Brian Vaughn
Re-add "strict effects mode" for legacy roots only (react#20639)
f92ae62
This combines changes originally made in react#19523, react#20028, and react#20415 but with slightly different semantics: "strict effects" mode is enabled only for the experimental root APIs (never for legacy render, regardless of <StrictMode> usage). These semantics may change slightly in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@acdlite acdlite Awaiting requested review from acdlite
2 more reviewers
@sebmarkbage sebmarkbage sebmarkbage requested changes
@bvaughn bvaughn bvaughn approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@bvaughn bvaughn

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

9 participants

@lunaruan @sizebot @oriSomething @bvaughn @vkurchatkin @gaearon @matthargett @sebmarkbage @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.