Repository navigation
fix: react-hooks lint rules as errors, and the ticket report's period chart in the ECharts showcase - #234
Merged
Conversation
…e ECharts showcase - shared/js/useLatest.js: the latest props for handlers registered once, written in an insertion effect instead of during render (React 18 has no useEffectEvent) - EChart, Perspective, PivotReport and the pivot hooks: refs no longer written during render, effect dependencies complete; the chart-creating effect keeps its two dependencies on purpose (disabled with the reason) - useTemplateEndpoints: new server templates reset the local ones during render, not in an effect - usePsuTheme keeps its object when the colours did not change - eslint.config.js: recommended-latest rules on, exhaustive-deps an error - ECharts showcase: the period chart ends on the newest ticket's day, the averages are labelled at opposite ends, the per-day chart no longer parses dates in the server's culture Refs #217 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… names, useLatest in AGENTS.md Refs #217 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # build/growth-baseline.json
This was referenced Nov 25, 2026
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.
Summary
The lint follow-up of #217: the React code passes
eslint-plugin-react-hooksrecommended-latest, andexhaustive-depsis an error. Two bugs in the ECharts showcase's ticket report are fixed too.Refs #217
Lint (
npm run lintbefore: 9 warnings; with the stricter rules 18 errors; now 0)shared/js/useLatest.js(new): a ref with the latest value for handlers registered once. It is written inuseInsertionEffect, not during render. React 18.3.1 has nouseEffectEvent. The insertion effect runs before every layout effect of the commit, children's included, so a callback that pivotkit fires from its own layout effect reads the new props.useTemplateEndpoints: new server templates reset the local ones during the render that brings them, not in an effect after it.usePsuThemekeeps its object when the colours did not change, sopsuThemecan be a dependency.Showcase, ticket report
$Cache:for days, so the last days of "This period" were 0. The period now ends on the newest ticket's day.insideEndTopand series 1 atinsideEndBottom, so those labels face each other. The previous period's label is now at the start of its line.[datetime], which throws a FormatException under de-DE. The test below found this.Whole-change check
I read every changed file in full. Each function has one job.
shared/js/useLatest.jsref.current = propscopies (ECharts, Perspective, Pivot). AGENTS.md lists it under Layout.shared/js/psuTheme.jsEChart.jsxrememberis auseCallback.customThemeis memoized by its key.Perspective.jsxprepared(data and column names).useLatestforlatestandmodeRef.columnNameswith the same rows now reach the viewer (CHANGELOG).PivotReport.jsxuseLatestforlatestandviewRef.useStoredView.js,useLoadedFile.js,useTemplateEndpoints.jslatestRef, so the compiler rules see a ref.eslint.config.jsrecommended-latestrules,exhaustive-depsas an error.Showcase.ps1(ECharts demo)-Optionsdeep merge (mergeOptions) instead of a module change.tests/powershell/ECharts.Tests.ps1PivotDemo.Tests.ps1.Not changed here, worth a follow-up: the module's
markLineOfalternates top and bottom by series index. Close averages, where the second is higher, overlap in any chart, not only in the showcase.Neutral review
A read-only reviewer reviewed the first commit in its own worktree: target, "behaviour must not change", the React 18.3.1 constraint, evidence for every finding.
prepareddependency also reacts to newcolumnNames. The comment "keeps its layout" was wrong for that case. Fixed: I corrected the comment and the CHANGELOG says that the view starts again, as with new columns.react-hooks/refsdisable withuseState. I tried that before the review: theimmutabilityrule then flags the tooltip state mutations. Kept, with the reason in the code.useLatest.js(fixed).onViewChangeoronDataLoadduring render? Answered below: no.Checked on PowerShell Universal
PSU 2026.3.4, the four modules built from this branch, every app that uses them restarted. Each page loaded the branch's bundles: ECharts
index.7ffb21e4…, Perspectiveindex.1371585b…, Pivotindex.54516e00…. Chromium unless noted.zeros: 0). The labels are atinsideEndTopandinsideStartBottom. The screenshots in light and dark, 1400 and 390 px wide, show the two "Average" labels apart. On main:('This period', 3 zeros, 'insideEndTop'), ('Previous period', 0, 'insideEndBottom').Tickets: Applications, P1 (58)).Tickets: 11/5/2026 to 11/15/2026 (181)).Get-UDElement, linked charts with-Group, hover tooltippsu.spec: 48 passed in all three browsers.-LightTheme/-DarkTheme#003b6f, #f28c28in light and#6fa8dc, #f6b26bafter PSU's switch.chart.csvarrived. Full screen turned on.aria-pressed. Chart switches toY Barand Table toDatagrid.-OnViewChange,-OnCellClick, a loaded file with Undo/Redo and "Back to original data", templates in the browser, light/dark, phone widthpsu-pivot.spec: 113 passed, 12 skipped, 1 failed: WebKit "Back to original data after more files…" with "ResizeObserver loop completed with undelivered notifications", the known #218, also failing on main.psu-pivot-demo.spec: 24 passed, 6 skipped. Screenshots light and dark, 1400 and 390 px: no page errors.dist/index.js.onViewChangeis called only inapply, which is called fromcommit, undo/redo andrestore, which are event handlers.restoreis also called from a mount effect (history.restore(view), line 4273) and the mount layout effect ofuseKeepData(line 4094).onDataLoadis called fromtellinimport-ui.js(load, undo/redo,restoreDatain that layout effect). SinceuseLatestwrites in an insertion effect, which runs before those layout effects, these callbacks see the current props.Afterwards the instance runs the build from main again (with its pinned pivotkit packages), and the apps load.
Checklist
docs/and the module'sCHANGELOG.mddescribe the new stateTest plan
npm run lint(exit 0,--max-warnings 0),npm test(219 pass, 0 fail),npm run growth(all ok),Invoke-Pester -Path tests/powershell(380 passed, 0 failed, 7 skipped),Invoke-ScriptAnalysis.ps1(exit 0),Build-Module.ps1for the four modules, the site build, andnpm run test:browser(87 passed in Chromium, Firefox and WebKit; the PSU specs were skipped there and run separately above)🤖 Generated with Claude Code