Skip to content

Optimize destructured prop rest property loads#36282

Draft
arsyadal wants to merge 1 commit intofacebook:mainfrom
arsyadal:arsyadal-fix-compiler-props-destructure-optimization
Draft

Optimize destructured prop rest property loads#36282
arsyadal wants to merge 1 commit intofacebook:mainfrom
arsyadal:arsyadal-fix-compiler-props-destructure-optimization

Conversation

@arsyadal
Copy link
Copy Markdown

Summary

  • rewrite property loads from non-mutated object-rest temporaries back to the original prop source when the property was not excluded by the destructure
  • let later passes drop the unnecessary rest object so components can memoize against props.foo instead of the whole props object
  • add regression tests covering both the optimized case and the excluded-property case

Testing

  • node /tmp/react-36281/node_modules/jest/bin/jest.js --config ./scripts/jest/main.config.js src/__tests__/OptimizeDestructurePropertyLoads-test.ts --runInBand

Closes #36281

@meta-cla meta-cla bot added the CLA Signed label Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compiler Bug]: Destructuring props leads to under-optimized component

1 participant