Skip to content

Preserve module global snapshots before reassignment#36396

Open
raashish1601 wants to merge 1 commit intofacebook:mainfrom
raashish1601:codex/global-assignment-effect-copy
Open

Preserve module global snapshots before reassignment#36396
raashish1601 wants to merge 1 commit intofacebook:mainfrom
raashish1601:codex/global-assignment-effect-copy

Conversation

@raashish1601
Copy link
Copy Markdown

Summary

  • stop constant propagation from treating module-local global loads as reusable constants
  • preserve copied module-local values across later module-global assignments in outlined effect callbacks
  • add a regression fixture for a useEffect cleanup that captures a module-global snapshot before i += 1

Issue

Fixes #34899.

Validation

  • corepack yarn workspace snap run snap --pattern global-copy-before-assignment-in-effect --sync
  • corepack yarn workspace babel-plugin-react-compiler run lint -- --quiet
  • corepack yarn prettier
  • git diff --cached --check

@meta-cla meta-cla Bot added the CLA Signed label May 2, 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]: Incorrect JS output when copying and updating global variable with += in useEffect

1 participant