Skip to content

feat(react-compiler): support update expressions on captured variables - #26893

Closed
Boshen wants to merge 19 commits into
mainfrom
codex/react-compiler-captured-update-expressions
Closed

Boshen wants to merge 19 commits into
mainfrom
codex/react-compiler-captured-update-expressions

Conversation

@Boshen

@Boshen Boshen commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Ports React commit d0a776cde3.

Validation for this stack:

  • cargo test -p oxc_react_compiler on every layer
  • just ready on the top layer
  • React Rust runtime suite: 1,824 passed, 0 failed

AI disclosure: Codex was used to port, review, and test this change.


Stack created with GitHub Stacks CLI • Give Feedback 💬

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T07:13:49.279223Z 90c1a71 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Boshen
Boshen added this pull request to stack #26897 September 21, 2026 12:39
@github-actions github-actions Bot added the A-react-compiler Area - React Compiler transforms and lint rules, oxc_react_compiler label Sep 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7fbc119b3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codspeed

codspeed Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 14.56%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 4 regressed benchmarks
✅ 6 untouched benchmarks
⏩ 86 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ react_compiler[kitchen-sink.tsx] 483.8 ms 624.2 ms -22.49%
❌ linter[kitchen-sink.tsx] 777.4 ms 918 ms -15.32%
❌ react_compiler[RadixUIAdoptionSection.jsx] 4.8 ms 5.4 ms -10.74%
❌ linter[RadixUIAdoptionSection.jsx] 5.8 ms 6.4 ms -9.03%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing codex/react-compiler-captured-update-expressions (90c1a71) with main (0c924f2)

Open in CodSpeed

Footnotes

  1. 86 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from 5ecda56 to 3194ca1 Compare September 22, 2026 02:01
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch from 7fbc119 to 23d1549 Compare September 22, 2026 02:01
@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from 3194ca1 to 0c2c7e9 Compare September 22, 2026 02:17
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch from 23d1549 to 9fef25b Compare September 22, 2026 02:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fef25b7cb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from 0c2c7e9 to 31b9b9a Compare September 22, 2026 02:45
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch from 9fef25b to 08f2918 Compare September 22, 2026 02:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08f29184ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from 31b9b9a to d02905a Compare September 22, 2026 03:16
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch from 08f2918 to 16789ae Compare September 22, 2026 03:16
@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from d02905a to a5a7b41 Compare September 22, 2026 09:55
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch from 16789ae to 595e303 Compare September 22, 2026 09:56
@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from a5a7b41 to 2c6b69c Compare September 22, 2026 10:21
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch from 595e303 to a300ae0 Compare September 22, 2026 10:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a300ae08a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from 2c6b69c to 7c1fc66 Compare September 22, 2026 10:30
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch from a300ae0 to 7d1846a Compare September 22, 2026 10:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d1846a399

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from 7c1fc66 to 63a0353 Compare September 22, 2026 11:05
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch from 7d1846a to ac845d8 Compare September 22, 2026 11:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac845d8cdb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Boshen
Boshen force-pushed the codex/react-compiler-ref-location-phi branch from 63a0353 to 28ecee7 Compare September 22, 2026 11:16
@Boshen
Boshen force-pushed the codex/react-compiler-captured-update-expressions branch 2 times, most recently from ac845d8 to 120deb3 Compare September 22, 2026 11:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 120deb3228

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Boshen
Boshen removed this pull request from stack #26897 September 24, 2026 07:14
@Boshen
Boshen added this pull request to stack #27005 September 24, 2026 07:14
@Boshen
Boshen removed this pull request from stack #27005 September 25, 2026 08:03
@Boshen
Boshen added this pull request to stack #27040 September 25, 2026 08:03
@Boshen
Boshen removed this pull request from stack #27040 September 25, 2026 08:08
@Boshen Boshen closed this Oct 29, 2026
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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
function returns the result of passing a callback that reassigns one of
its parameters or locals, like a loader that returns
`fetchPage(page).then((next) => { rows = rows.concat(next); … })`.
0.156.0 and babel-plugin-react-compiler@1.0.0 compile it. With
panicThreshold set to 'critical_errors' or 'all_errors', the new
diagnostic fails the build. Common shapes are unaffected: an effect
whose cleanup sets a `cancelled` flag, a handler that reassigns a local
in a `.then` callback without returning the promise, a `forEach` that
accumulates into a local. The changeset documents the skip, that build
failure and reportDiagnostics to find the skipped functions.

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 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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
A component that increments a variable a closure captures, like a
count of selected items that an onClick callback reads, was left
uncompiled through 0.156.0 ("Handle UpdateExpression to variables
captured within lambdas"), and babel-plugin-react-compiler@1.0.0 bails
with the same message. Compiled as of 0.157.0 (oxc-project/oxc#26893);
rendered and clicked, it matches the uncompiled component. The test
fails against 0.156.0 and passes against 0.157.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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);
… })`. 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. 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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
A component that increments a variable a closure captures, like a
count of selected items that an onClick callback reads, was left
uncompiled through 0.156.0 ("Handle UpdateExpression to variables
captured within lambdas"), and babel-plugin-react-compiler@1.0.0 bails
with the same message. Compiled as of 0.157.0 (oxc-project/oxc#26893);
rendered and clicked, it matches the uncompiled component. The test
fails against 0.156.0 and passes against 0.157.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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);
… })`. 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. 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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
A component that increments a variable a closure captures, like a
count of selected items that an onClick callback reads, was left
uncompiled through 0.156.0 ("Handle UpdateExpression to variables
captured within lambdas"), and babel-plugin-react-compiler@1.0.0 bails
with the same message. Compiled as of 0.157.0 (oxc-project/oxc#26893);
rendered and clicked, it matches the uncompiled component. The test
fails against 0.156.0 and passes against 0.157.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
A component that increments a variable a closure captures, like a
count of selected items that an onClick callback reads, was left
uncompiled through 0.156.0 ("Handle UpdateExpression to variables
captured within lambdas"), and babel-plugin-react-compiler@1.0.0 bails
with the same message. Compiled as of 0.157.0 (oxc-project/oxc#26893);
rendered and clicked, it matches the uncompiled component. The test
fails against 0.156.0 and passes against 0.157.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 6, 2026
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
acusti pushed a commit to acusti/uikit that referenced this pull request Nov 12, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-react-compiler Area - React Compiler transforms and lint rules, oxc_react_compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant