Repository navigation
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4162 +/- ##
==========================================
+ Coverage 98.96% 99.13% +0.16%
==========================================
Files 46 46
Lines 2030 2186 +156
Branches 792 961 +169
==========================================
+ Hits 2009 2167 +158
+ Misses 21 19 -2
🚀 New features to boost your workflow:
|
nstepien
marked this pull request as draft
August 29, 2026 16:02
nstepien
force-pushed
the
react-compiler-diagnostics
branch
from
August 31, 2026 18:30
d62c1db to
5b5e866
Compare
nstepien
force-pushed
the
react-compiler-diagnostics
branch
from
September 1, 2026 15:01
5b5e866 to
85c3508
Compare
`tsdown` now logs 21 React Compiler diagnostics, each one causing the compiler to skip optimizing the enclosing component or hook. Unsupported syntax: - `useColumnWidths`: replace `||=` with an `if` statement. Note that `hasChanges = hasChanges || …` would trip `eslint/logical-assignment-operators`. - `useCalculatedColumns`/`useViewportRows`: replace `x++` on variables captured within lambdas with `x += 1`. - `useViewportColumns`/`DataGrid`: generators cannot be lowered at all, so hoist every `function*` out of the hook/component body to module scope and pass what they used to close over as parameters. Two now-unused `react/memo-dependencies` suppressions are dropped, as the compiler was previously bailing on the whole file. Immutability: - `GroupRow`: `let idx` was mutated inside the render `.map()`. The increment only ever depended on whether the first rendered column is the select column, so materialize the columns once and compute `groupColumnIndex` as a constant before the JSX. - `DataGrid`: `setPosition` was read by `useImperativeHandle`/`useLatestFunc` before its declaration, so move the declaration above the `Misc hooks` block. Invariant: - `EditCell`: `cancelTask` was a hoisted function referenced by an effect declared above it. Extract it to module scope taking the three refs, which keeps the effect's `[commitOnOutsideClick]` dependency list correct — adding a component-body `cancelTask` as a dependency would make the effect tear down between re-renders, which the comment there explicitly guards against. `onClose` also moves above the `useEffectEvent` that calls it. Unreachable hoisted declaration: - `TreeDataGrid`: `isGroupRow` was declared after a `return`, so move it above the early return. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019NZmYxgysVEbw12FnbAf7x
nstepien
force-pushed
the
react-compiler-diagnostics
branch
from
September 4, 2026 12:08
85c3508 to
831245c
Compare
…stics # Conflicts: # src/DataGrid.tsx # src/EditCell.tsx # src/GroupedRow.tsx # src/TreeDataGrid.tsx # src/hooks/useViewportColumns.ts
- `GroupedRow`: instead of incrementing `idx` in the `mapViewportColumns` callback, compare each column with the `groupBy` key of the row's level, and pass `isLevelMatching` to `GroupCell`. The group-by columns follow the select column in `groupBy` order, so this is equivalent to the column index check, without depending on whether the select column is rendered. - `EditCell`: move `cancelTask` to module scope, taking the two refs, so the `useLayoutEffect` cleanup can call it without depending on it, and declare `onClose` before the `useEffectEvent` that calls it. - `DataGrid`: the imperative handle exposes `setPositionLatest` instead of `setPosition`. Reading the hoisted `setPosition` in the `useImperativeHandle` callback is what stopped the compiler, and the handle's `setActivePosition` is now stable across renders. - Enable `react/todo`, so oxlint reports the syntax React Compiler doesn't support yet, like `||=` and `x++` on variables captured by nested functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…React Compiler diagnostics
- One `react()` instance now serves both Vite and `vp pack`: it produces
identical `lib/` and website builds, and the same dev-server modules.
Vite and `vp pack` never run in the same process, so the plugin's
per-run state isn't shared.
- Keep excluding `.d.ts` files: `vp pack` passes the declaration files it
generates through the plugin, and without the exclusion, `lib/index.d.ts`
becomes `export {}`. `node_modules` stays excluded, as replacing the
default `exclude` would otherwise compile dependencies in Vite.
- `reportDiagnostics: true` turns the code React Compiler skips into plugin
warnings, which fail `vp pack` in CI and agent sessions through
`failOnWarn`, and are logged by `vp dev`, `vp build`, and `vp test`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
vp packcompilessrc/with React Compiler, which skips every component or hook it can't compile. Onmain, it skipsDataGrid,EditCell,GroupedRow,useCalculatedColumns,useColumnWidths, anduseViewportRows. After this PR, all of them are compiled, and if a bail-out comes back, oxlint reports it andvp packfails in CI.Unsupported syntax
useColumnWidths: replace||=with anifstatement.hasChanges = hasChanges || …would tripeslint/logical-assignment-operators.useCalculatedColumns/useViewportRows: replacex++on variables captured by nested functions withx += 1.react/todo, which reports both. It was turned off in oxlint: configure react rules #4155, before React Compiler was set up, while the generators couldn't be compiled either. ReplaceiterateOverViewportColumnsForRowwithmapViewportColumns, and fix cells hidden bycolSpan#4225 removed them.Immutability
GroupedRow:let idxwas incremented in themapViewportColumnscallback when the first rendered column was the select column, andGroupCellcompared it withcolumn.idx. The group-by columns follow the select column ingroupByorder, soGroupedRownow compares each column's key withgroupBy[row.level]and passes the result toGroupCellasisLevelMatching.Hoisted functions
DataGrid: theuseImperativeHandlecallback readsetPosition, which is declared further down. The handle now exposessetPositionLatest, which also keeps itssetActivePositionstable across renders, and thereact/immutabilitysuppression is gone.EditCell: theuseLayoutEffectcleanup calledcancelTask, which was declared after the effect. It moves to module scope and takes the two refs: declared in the component, it would have to be an effect dependency, and the effect must not clean up between re-renders, as the comment there explains.onClosealso moves above theuseEffectEventthat calls it. TheTODO: report React Compiler bugnote and itsreact/invariantsuppression are gone.Build
compiler: { reportDiagnostics: true }turns the code React Compiler skips into plugin warnings.vp packalready fails on warnings in CI and agent sessions (failOnWarn: isAgent || 'ci-only'), andvp dev,vp build, andvp testlog them. Unlike lint, a suppression comment doesn't hide them.panicThreshold: 'all_errors'would fail every build, including the dev server and tests while code is being edited, and'critical_errors'misses unsupported syntax likex++.react()instance now serves both Vite andvp pack. It produces identicallib/and website builds, and the same dev-server modules.vp packcan't uselazyPlugins, so its plugins were already created on every config load. The plugin keeps some per-run state, like whether to emit development JSX, which is fine because Vite andvp packnever run in the same process..d.tsfiles stay excluded:vp packpasses the declaration files it generates through the plugin, and without the exclusion,lib/index.d.tsbecomesexport {}, which publint doesn't catch.node_modulesstays excluded too, as settingexcludereplaces the plugin's default.vp packfails on code React Compiler can't compile.vp run cipasses.🤖 Generated with Claude Code