react icon indicating copy to clipboard operation
react copied to clipboard

Add Cloned flag to avoid extra clones in persistent renderer

Open kassens opened this issue 2 years ago • 1 comments

Persistent renderers used the Update effect flag to check if a subtree needs to be cloned. In some cases, that causes extra renders, such as when a layout effect is triggered which only has an effect on the JS side, but doesn't update the host components.

This is an alternative to #27533 following @acdlite comment to create a new flag to be set whenever a clone is needed.

It's been a bit tricky to find the right places where this needs to be set and I'm not 100% sure I got all the cases even though the tests passed.

Todo

  • [ ] add feature flag to gate the rollout for testing
  • [ ] test for ref and useImperativeHandle

kassens avatar Nov 03 '23 20:11 kassens

Comparing: 56dbd58feb1a75f075c67067ce0d20d7cee7f482...966936b724a04524df9c4a0c3f61cb7f420b9f40

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.68 kB 6.68 kB +0.11% 1.82 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 500.39 kB 500.39 kB = 89.78 kB 89.78 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 507.52 kB 507.52 kB = 90.95 kB 90.95 kB
facebook-www/ReactDOM-prod.classic.js = 595.41 kB 595.41 kB = 105.58 kB 105.58 kB
facebook-www/ReactDOM-prod.modern.js = 571.71 kB 571.71 kB = 101.78 kB 101.78 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/implementations/ReactFabric-prod.fb.js +0.20% 370.95 kB 371.69 kB +0.18% 64.92 kB 65.04 kB

Generated by :no_entry_sign: dangerJS against 13251f18a6cfbf7a0651b5b966f9685dd686142a

react-sizebot avatar Mar 06 '24 23:03 react-sizebot

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 10:08pm

vercel[bot] avatar Jun 20 '24 22:06 vercel[bot]