-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Open
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bugType: Bug
Description
What kind of issue is this?
- React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
- babel-plugin-react-compiler (build issue installing or using the Babel plugin)
- eslint-plugin-react-hooks (build issue installing or using the eslint plugin)
- react-compiler-healthcheck (build issue installing or using the healthcheck script)
Link to repro
Repro steps
There is no sense to throw an error about unsupported features inside callbacks
./agents-manage-ui/src/app/login/page.tsx
Error evaluating Node.js code
ReactCompilerError: Found 1 error:
Todo: Support value blocks (conditional, logical, optional chaining, etc) within a try/catch statement
78 |
79 | // Check if sign-in failed
> 80 | if (result?.error) {
| ^^^^^^ Support value blocks (conditional, logical, optional chaining, etc) within a try/catch statement
81 | setError(result.error.message || 'Sign in failed');
82 | setIsLoading(false);
83 | return;Issue
React Compiler throws hard errors for unsupported features (e.g. optional chaining) inside try/catch within callbacks, even though the code is valid and runs correctly. This forces large mechanical refactors (100+ cases in our codebase) purely to satisfy compiler limitations.
Proposal
Allow opting out of compiler checks for callbacks via a directive:
const handleExternalSignIn = async (...) => {
'use no memo'; // skip React Compiler checks for this callbackWhy
Callbacks aren’t render-critical, so hard compiler errors for valid JS inside them hurt DX without real benefit.
How often does this bug happen?
Every time
What version of React are you using?
latest
What version of React Compiler are you using?
latest
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bugType: Bug