Repository navigation
fix(react-compiler): ignore callback-local reassignments - #28820
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
Restrict post-render reassignment tracking to bindings declared in the outer component or hook, matching upstream React Compiler. This stops `react/immutability` from flagging callback-local variables reassigned by nested synchronous or async closures. Add compiler and Oxlint CLI regressions while retaining errors for render-scope bindings. Fixes #28401
69abfff to
3d3a6f4
Compare
# Oxlint ### 🚀 Features - 4a52ba2 oxlint: Discover tsrs for type-aware linting (#28751) (camc314) - b7d2c75 linter/eslint/no-redeclare: Add `ignoreDeclarationMerge` option (#28816) (Cam McHenry) ### 🐛 Bug Fixes - fa66fde oxlint,oxfmt: Resolve Vite+ config root from the config file directory (#28801) (MK (fengmk2)) - 2091564 linter/jsdoc/require-param: Ignore enclosing function JSDoc (#28866) (camc314) - c6ec50b linter/react/only-export-components: Classify JSX values as non-components (#28761) (camc314) - 3c051ab linter/vitest/prefer-called-exactly-once-with: Preserve neighboring code in autofix (#28864) (camc314) - 674b962 linter/eslint/no-misleading-character-class: Use lazy regex for combining marks (#28822) (Sysix) - 838d339 linter/vitest/prefer-called-exactly-once-with: Avoid panic on non-ASCII text (#28850) (YT) - 8d24c26 linter/jsx-a11y/aria-role: Allow role={undefined} (#28804) (Abhay Godavarthy) - a7143bf linter/eslint/no-restricted-imports: Respect allowTypeImports correctly for empty patterns (#28842) (Cam McHenry) - 3d3a6f4 react-compiler: Ignore callback-local reassignments (#28820) (camc314) - 0cc6515 linter/unicorn/prefer-type-error: Report throws in unbraced if branches (#28819) (camc314) - ae43c80 linter/unicorn/prefer-single-call: Remove duplicate fix status (#28763) (Mikhail Baev) - a8a621a linter/eslint/no-fallthrough: Ignore unreachable exits from infinite loops (#28755) (camc314) - 7a17a80 linter/eslint/prefer-spread: Report calls on non-member expressions (#28753) (camc314) - 28442f7 oxlint: Prevent --init from overwriting existing configs (#28754) (camc314) - 0ae350d linter/unicorn/no-zero-fractions: Preserve exponent case (#28752) (camc314) - b5b3f3f linter/eslint/no-misleading-character-class: Detect more combining characters (#28733) (Sysix) ### ⚡ Performance - 74d50c1 linter: Overlap import graph batches instead of polling on a pool worker (#28323) (Dunqing) # Oxfmt ### 💥 BREAKING CHANGES - 00d1a67 oxfmt: [**BREAKING**] Format `parser:vue` files by `oxc_formatter_htmlish` (#28848) (leaysgur) ### 🚀 Features - 9a81e58 formatter_htmlish: Format Vue templates (#28847) (leaysgur) - 119d82f formatter: Format a template's expressions and handlers as `JsRoot` (#28846) (leaysgur) ### 🐛 Bug Fixes - fa66fde oxlint,oxfmt: Resolve Vite+ config root from the config file directory (#28801) (MK (fengmk2)) - 4d4104d formatter_htmlish: Preserve `doctype` case in embedded (#28797) (leaysgur) - ebfd40a formatter: Sort Tailwind calls printed as member chains (#28800) (Yuji Sugiura) - e62e5cb formatter: Decide quotes of a Tailwind key printed as one class (#28798) (Yuji Sugiura) - 959edc1 formatter: Don't sort templates in nested non-Tailwind calls (#28794) (Yuji Sugiura) - 6ffbe32 formatter/jsdoc: Prevent `@tag` from being moved to the line start (#28835) (leaysgur) - 94fbef5 formatter_css: Treat comments in `style` attr as fill items (#28832) (leaysgur) - e4a80f7 formatter_css: Normalize selectors inside `:deep`, `:slotted` and `:local` (#28805) (leaysgur) - 255c5cc formatter: Measure Tailwind class argument after collapsing whitespace (#28745) (Lee Jaeha / Adam) - e6c4fef formatter: Decide template and object key layouts from collapsed Tailwind classes (#28791) (Yuji Sugiura) - 0b44164 formatter: Decide JSX opening element layout from collapsed Tailwind class string (#28744) (Lee Jaeha / Adam) - b8ba9ae formatter: Print decorators on rest parameters (#28731) (YT) ### ⚡ Performance - 2766d07 oxfmt: Spawn Prettier workers on demand (#28789) (YT) - 07627f7 oxfmt: Use worker_threads for tinypool again (#28787) (Yuji Sugiura)
Exact pin in @acusti/vite-plugin-react-compiler, plus the root and docs devDependency ranges so bun hoists a single copy. The rewrite of the check for variables reassigned after render (oxc-project/oxc#26893, which also lets the compiler handle `count++` on a variable a closure captures) skips a component or hook in which a callback reassigns a variable declared in another callback rather than in the component or hook itself, in two ways: - an async function reassigning it ("Cannot reassign variable in async function"), like an effect that stores a connection from an async IIFE for its cleanup - a function returning the result of passing a callback that reassigns one of its parameters or locals ("Cannot reassign variable after render completes"), like `return items.map((item) => { n += 1; … })` or a loader that returns `fetchPage(page).then((next) => { rows = … })` 0.156.0 and babel-plugin-react-compiler@1.0.0 compile both. With panicThreshold set to 'critical_errors' or 'all_errors', the new diagnostics fail the build. Synchronous callbacks that don't flow into the function's return value still compile: an effect whose cleanup sets a `cancelled` flag, a `.then` callback whose promise isn't returned, a `forEach` that accumulates into a local. Upstream has since limited the check to bindings declared in the component or hook itself (oxc-project/oxc#28820, fixing oxc-project/oxc#28401), after 0.157.0 was published. The changeset documents both skips, the build failure, reportDiagnostics to find the skipped functions, rebinding with `const` where that works, and the upstream fix. The release also fixes compiled output that rendered stale values or threw where the uncompiled code doesn't, most of which babel-plugin-react-compiler@1.0.0 shares (see the pinned tests that follow), compiles code that 0.156.0 and the Babel plugin skip, leaves member chains longer than 500 links uncompiled instead of compiling them slowly or overflowing the stack, and removes an exponential type resolution that made a loop around a `try` take seconds and gigabytes to compile. The repo's own output changes in two files with default options: MonthCalendar.tsx keys its memo block on the `title` prop from before `title = title ?? …` (oxc-project/oxc#27420), so it no longer misses its cache on every render without a title, and useStyles.ts lowers `item.referenceCount++` as an increment (oxc-project/oxc#27424), with the same behavior for a number. No file in the repo changes whether it compiles, its diagnostics or its fatal status, with default options or compilationMode 'all'. The public typings add only a `typescript` transform option (enum inlining), which the plugin doesn't pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
As of 0.157.0 (oxc-project/oxc#26893, which rewrote the check for variables reassigned after render), a component or hook is left uncompiled ("Cannot reassign variable after render completes") when a function inside it returns the result of passing a callback that reassigns one of the function's parameters or locals, like a loader that returns `fetchPage(page).then((next) => { rows = rows.concat(next); … })`, or a helper that returns `items.map((item) => { n += 1; … })`. Each call has its own `rows`, so compiling it is safe, and 0.156.0 and babel-plugin-react-compiler@1.0.0 compile it. With panicThreshold set to 'critical_errors' or 'all_errors', the diagnostic fails the build. The same handler without the `return`, an effect whose cleanup sets a `cancelled` flag, and a `forEach` that accumulates into a local all still compile. Upstream limited the check to bindings declared in the component or hook after 0.157.0 was published (oxc-project/oxc#28820, fixing oxc-project/oxc#28401), which removes the code that treated an inner function's parameters and locals as context variables for its own closures, the path this input takes. Tracked as an it.fails test, which passes against 0.157.0 and fails against 0.156.0, so the bump that fixes it turns the test red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
As of 0.157.0 (oxc-project/oxc#26893, which rewrote the check for variables reassigned after render), a component or hook is left uncompiled ("Cannot reassign variable in async function") when an async function inside it reassigns a variable declared in another callback, like an effect that stores a connection from an async IIFE for its cleanup. The variable belongs to one run of the effect, so compiling it is safe, and 0.156.0 and babel-plugin-react-compiler@1.0.0 compile it. With panicThreshold set to 'critical_errors' or 'all_errors', the diagnostic fails the build. An async loader accumulating into an effect local and a handler's counter bumped in an async arrow are skipped the same way, while the same effect with `.then((s) => { socket = s; })` still compiles. Reassigning one of the component's own variables from an async function was already skipped on 0.156.0. Reported upstream as oxc-project/oxc#28401 and fixed after 0.157.0 was published by oxc-project/oxc#28820, which limits the check to bindings declared in the component or hook. It gets its own it.fails test, next to the one for a returned callback, so the bump that picks up the fix shows which of the two shapes it covers. It passes against 0.157.0 and fails against 0.156.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
Exact pin in @acusti/vite-plugin-react-compiler, plus the root and docs devDependency ranges so bun hoists a single copy. The rewrite of the check for variables reassigned after render (oxc-project/oxc#26893, which also lets the compiler handle `count++` on a variable a closure captures) skips a component or hook in which a callback reassigns a variable declared in another callback rather than in the component or hook itself, in two ways: - an async function reassigning it ("Cannot reassign variable in async function"), like an effect that stores a connection from an async IIFE for its cleanup - a function returning the result of passing a callback that reassigns one of its parameters or locals ("Cannot reassign variable after render completes"), like `return items.map((item) => { n += 1; … })` or a loader that returns `fetchPage(page).then((next) => { rows = … })` 0.156.0 and babel-plugin-react-compiler@1.0.0 compile both. With panicThreshold set to 'critical_errors' or 'all_errors', the new diagnostics fail the build. Synchronous callbacks that don't flow into the function's return value still compile: an effect whose cleanup sets a `cancelled` flag, a `.then` callback whose promise isn't returned, a `forEach` that accumulates into a local. Upstream has since limited the check to bindings declared in the component or hook itself (oxc-project/oxc#28820, fixing oxc-project/oxc#28401), after 0.157.0 was published. The changeset documents both skips, the build failure, reportDiagnostics to find the skipped functions, rebinding with `const` where that works, and the upstream fix. The release also fixes compiled output that rendered stale values or threw where the uncompiled code doesn't, most of which babel-plugin-react-compiler@1.0.0 shares (see the pinned tests that follow), compiles code that 0.156.0 and the Babel plugin skip, leaves member chains longer than 500 links uncompiled instead of compiling them slowly or overflowing the stack, and removes an exponential type resolution that made a loop around a `try` take seconds and gigabytes to compile. The repo's own output changes in two files with default options: MonthCalendar.tsx keys its memo block on the `title` prop from before `title = title ?? …` (oxc-project/oxc#27420), so it no longer misses its cache on every render without a title, and useStyles.ts lowers `item.referenceCount++` as an increment (oxc-project/oxc#27424), with the same behavior for a number. No file in the repo changes whether it compiles, its diagnostics or its fatal status, with default options or compilationMode 'all'. The public typings add only a `typescript` transform option (enum inlining), which the plugin doesn't pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
As of 0.157.0 (oxc-project/oxc#26893, which rewrote the check for variables reassigned after render), a component or hook is left uncompiled ("Cannot reassign variable after render completes") when a function inside it returns the result of passing a callback that reassigns one of the function's parameters or locals, like a loader that returns `fetchPage(page).then((next) => { rows = rows.concat(next); … })`, or a helper that returns `items.map((item) => { n += 1; … })`. Each call has its own `rows`, so compiling it is safe, and 0.156.0 and babel-plugin-react-compiler@1.0.0 compile it. With panicThreshold set to 'critical_errors' or 'all_errors', the diagnostic fails the build. The same handler without the `return`, an effect whose cleanup sets a `cancelled` flag, and a `forEach` that accumulates into a local all still compile. Upstream limited the check to bindings declared in the component or hook after 0.157.0 was published (oxc-project/oxc#28820, fixing oxc-project/oxc#28401), which removes the code that treated an inner function's parameters and locals as context variables for its own closures, the path this input takes. Tracked as an it.fails test, which passes against 0.157.0 and fails against 0.156.0, so the bump that fixes it turns the test red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
As of 0.157.0 (oxc-project/oxc#26893, which rewrote the check for variables reassigned after render), a component or hook is left uncompiled ("Cannot reassign variable in async function") when an async function inside it reassigns a variable declared in another callback, like an effect that stores a connection from an async IIFE for its cleanup. The variable belongs to one run of the effect, so compiling it is safe, and 0.156.0 and babel-plugin-react-compiler@1.0.0 compile it. With panicThreshold set to 'critical_errors' or 'all_errors', the diagnostic fails the build. An async loader accumulating into an effect local and a handler's counter bumped in an async arrow are skipped the same way, while the same effect with `.then((s) => { socket = s; })` still compiles. Reassigning one of the component's own variables from an async function was already skipped on 0.156.0. Reported upstream as oxc-project/oxc#28401 and fixed after 0.157.0 was published by oxc-project/oxc#28820, which limits the check to bindings declared in the component or hook. It gets its own it.fails test, next to the one for a returned callback, so the bump that picks up the fix shows which of the two shapes it covers. It passes against 0.157.0 and fails against 0.156.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
1.92.0 fixes a false positive in the React Compiler react(immutability) rule for variables reassigned inside async callbacks (oxc-project/oxc#28820). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bump the minor-and-patch group with 3 updates Bumps the minor-and-patch group with 3 updates: [@reduxjs/toolkit](https://github.com/reduxjs/redux-toolkit), [oxfmt](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxfmt) and [oxlint](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxlint). Updates `@reduxjs/toolkit` from 2.13.0 to 2.14.0 - [Release notes](https://github.com/reduxjs/redux-toolkit/releases) - [Commits](reduxjs/redux-toolkit@v2.13.0...v2.14.0) Updates `oxfmt` from 0.75.0 to 0.76.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxfmt/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxfmt_v0.76.0/npm/oxfmt) Updates `oxlint` from 1.90.0 to 1.91.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxlint/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxlint_v1.91.0/npm/oxlint) --- updated-dependencies: - dependency-name: "@reduxjs/toolkit" dependency-version: 2.14.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: oxfmt dependency-version: 0.76.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: oxlint dependency-version: 1.91.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-and-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump oxlint from 1.91.0 to 1.92.0 1.92.0 fixes a false positive in the React Compiler react(immutability) rule for variables reassigned inside async callbacks (oxc-project/oxc#28820). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Scott Hardy <scott.the.hardy@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1.92.0 fixes a false positive in the React Compiler react(immutability) rule for variables reassigned inside async callbacks (oxc-project/oxc#28820). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1.92.0 fixes a false positive in the React Compiler react(immutability) rule for variables reassigned inside async callbacks (oxc-project/oxc#28820). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Exact pin in @acusti/vite-plugin-react-compiler, plus the root and docs devDependency ranges so bun hoists a single copy. The rewrite of the check for variables reassigned after render (oxc-project/oxc#26893, which also lets the compiler handle `count++` on a variable a closure captures) skips a component or hook in which a callback reassigns a variable declared in another callback rather than in the component or hook itself, in two ways: - an async function reassigning it ("Cannot reassign variable in async function"), like an effect that stores a connection from an async IIFE for its cleanup - a function returning the result of passing a callback that reassigns one of its parameters or locals ("Cannot reassign variable after render completes"), like `return items.map((item) => { n += 1; … })` or a loader that returns `fetchPage(page).then((next) => { rows = … })` 0.156.0 and babel-plugin-react-compiler@1.0.0 compile both. With panicThreshold set to 'critical_errors' or 'all_errors', the new diagnostics fail the build. Synchronous callbacks that don't flow into the function's return value still compile: an effect whose cleanup sets a `cancelled` flag, a `.then` callback whose promise isn't returned, a `forEach` that accumulates into a local. Upstream has since limited the check to bindings declared in the component or hook itself (oxc-project/oxc#28820, fixing oxc-project/oxc#28401), after 0.157.0 was published. The changeset documents both skips, the build failure, reportDiagnostics to find the skipped functions, rebinding with `const` where that works, and the upstream fix. The release also fixes compiled output that rendered stale values or threw where the uncompiled code doesn't, most of which babel-plugin-react-compiler@1.0.0 shares (see the pinned tests that follow), compiles code that 0.156.0 and the Babel plugin skip, leaves member chains longer than 500 links uncompiled instead of compiling them slowly or overflowing the stack, and removes an exponential type resolution that made a loop around a `try` take seconds and gigabytes to compile. The repo's own output changes in two files with default options: MonthCalendar.tsx keys its memo block on the `title` prop from before `title = title ?? …` (oxc-project/oxc#27420), so it no longer misses its cache on every render without a title, and useStyles.ts lowers `item.referenceCount++` as an increment (oxc-project/oxc#27424), with the same behavior for a number. No file in the repo changes whether it compiles, its diagnostics or its fatal status, with default options or compilationMode 'all'. The public typings add only a `typescript` transform option (enum inlining), which the plugin doesn't pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
Restrict post-render reassignment tracking to bindings declared in the outer component or hook, matching upstream React Compiler. This stops
react/immutabilityfrom flagging callback-local variables reassigned by nested synchronous or async closures.Add compiler and Oxlint CLI regressions while retaining errors for render-scope bindings.
Fixes #28401