Repository navigation
[BREAKINGCHANGE] Upgrade Oxlint and fix React Compiler errors - #310
Conversation
c001021 to
21daa42
Compare
|
on the paper I am fine with the changes. Just wondering how much the breaking changes are ok. |
| const tooltipElementRef = useRef<HTMLDivElement | null>(null); | ||
|
|
||
| const mousePos = useMousePosition(); | ||
| const { mousePos, nearbySeries } = useChartTooltipData({ |
There was a problem hiding this comment.
This seems a change that can be it's own PR
|
Not sure why a change in the linter will create breaking changes on the code. Is this because of react compiler? If so I'll suggest to split this PR into several ones, oxlint changes, react compiler, etc.. I also saw some new performance tests and new components being created, I think the changes are necessary but at the current stage they are hard to review. |
|
Yeah I added a optimization on timeserieschart tooltip on the way, because I found timeserieschart slower after lint fixes 😅 I did something similar on plugin PR with improvement for timeserieschart. But yeah I will split PR 🥲 |
- Upgrade oxlint to 1.85.0 and oxfmt to 0.70.0 - Enable React Compiler and React Doctor rules as errors - Fix violations and remove useMemoized/useDeepMemo Signed-off-by: Guillaume LADORME <gladorme@gmail.com>
Enable typescript/no-explicit-any as an error and replace existing violations with checked types. Narrow resource display settings, type table cell values, and pass only available query data to panel actions. Signed-off-by: Guillaume LADORME <gladorme@gmail.com>
675dfd0 to
8d05386
Compare
|
I guess this is not a breaking change now. Can you update the title @Gladorme ? |
|
|
since the PR has been splitted, what do you think now @jgbernalp ? |
|
Review from Opus 5.5: Review: #310, "[BREAKINGCHANGE] Upgrade Oxlint and fix React Compiler errors"Verdict: Request changes. One bug causes an infinite render loop, and a few breaking changes are missing from the PR description. The rest of the PR is good cleanup. Checks run on the PR branch: 🔴 Must fix1. Infinite update loop in
🟠 Should fix2. Undocumented breaking type changes. The PR description lists only the
3. Removing 4.
🟡 Worth discussing
⚪ Nits
👍 Good changes
|
Apply plugin initialization once per selection request even when the parent omits metadata, and ignore stale loads. Keep pending text input across onChange callback changes. Add regression coverage for both review findings and selection races. Signed-off-by: Guillaume <gladorme@gmail.com>
b72b6bf to
652c336
Compare
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Re-review of head
|
| # | Issue | Status |
|---|---|---|
| 1 | Infinite update loop in usePluginEditor when the owner drops metadata (DatasourceEditorForm, AnnotationEditorForm and QueryEditorContainer all do) |
✅ Fixed. I reran my repro (a parent that drops metadata, then selecting a versioned variant): it hit "Maximum update depth exceeded" on the previous head and now calls onChange exactly once. A failed load now reports the error without calling onChange. The new stale-load and unmount tests are good. |
| 2 | Breaking type changes (Resource.spec, TableColumnConfig) not documented |
✅ Now listed in the PR description. |
| 3 | useDeepMemo is still used by perses/plugins (GaugeChartBase.tsx) |
✅ Handled in perses/plugins#826. The two PRs should be merged together. |
| 4 | TextField dropped pending debounced input when onChange identity changed |
✅ Fixed with the latest-ref pattern, and covered by a test. |
| — | Plugin actions only received queries with data | ✅ Reverted: all queries are passed again, in order. |
Still open (non-blocking, could be follow-ups)
HTTPSettingsEditorcallsonChangeon mount when neitherdirectUrlnorproxyis set, even whenisReadonly. BecauseDatasourceEditorFormcompares the current form values with the initial definition on cancel, this can show the discard dialog when the user changed nothing.TimeChartTooltiprenders twice per mouse move.nearbySeriesis now computed in a layout effect and stored in state. Moving it out of render makes sense becausegetNearbySeriesDatacallsdispatchAction(highlight/downplay), which is a side effect. But this is a hot path, so it could keep the pure calculation in render and move only the dispatch calls into an effect.useIdnow returns React's:r0:-style IDs. These contain colons, so any consumer that builds#idselectors (for example, fordocument.querySelector) has to escape them. Worth a note in the breaking changes.EChartnow needsResizeObserver. jsdom doesn't provide it, so downstream tests that renderEChartwithout mocking it will throw. Most perses/plugins tests mockEChart, so the risk is low.
New comments on the latest commits (non-blocking)
Panel.tsx:action.component as ComponentType<typeof panelPropsForActions>hides a mismatch in the public contract.PanelProps.queryResults[].datais typed as always present, but actions can receiveundefined. Longer term, the action props type should declaredata?: Tso plugin authors handle it.plugin-editor-api.ts:- The
['getPlugin', type, kind, version, registry]query key is now duplicated fromusePlugininplugin-registry.ts. A shared key helper would stop the two from drifting apart and silently losing cache sharing. queryClient.fetchQuerydefaults toretry: false, while the oldusePlugin(useQuery) retried 3 times. Remote plugin loads will now fail on the first network error. Consider settingretryexplicitly.- The comment on
reset()depends on react-query v4 internals, andisLoadingbecomesisPendingfor mutations in v5. This will need another look during the v5 upgrade.
- The
- Nits:
UsageMetricsProviderstill rebuildsctx(a newMap, counters reset to 0) on every render. That predates this PR, and moving the mutation intorecordQuerymostly hides it from the compiler lint. KeepingctxinuseStateor a ref would actually fix it.VirtualizedTableno longer uses thecolumnSizingandcolumnSizingInfoprops.- A short comment on why
use-save-dashboardandDatasourceTestConnectionButtonusePromise.then().finally()instead oftry/finally(I assume React Compiler doesn't supportfinally) would help future readers.
👍 Good changes
PluginLoaderComponentnow remounts on the full plugin identity (module, name, registry, version, base URL) and ignores stale loads.DashboardProviderno longer creates a store on every render.EChartuses aResizeObserverinstead of the fragilesx/styleeffect.TextVariablederives its state during render instead of in an effect.- Mutations of props are removed, and there's good new test coverage.
|
@Gladorme based on the AI said, it is worth to consider the point 3 for the documentation at least |
|
Will be removed in a next PR (#319, PR will be split in multiple PRs once this one is merged) |
|
I am ok to move forward with this PR. @jgbernalp do you have any other concerns ? |
|
|

Description
Enforcing stricter rules around React to be compliant with React Compiler rules (https://oxc.rs/blog/2026-08-18-react-compiler-support).
Breaking changes:
useDeepMemoanduseMemoizedby ReactuseMemo.specchanges fromanytounknown.unknown, andcellDescriptionnow takesCellContext<T, unknown>.Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
See e2e docs for more details. Common issues include: