Repository navigation
fix(plugin-charts): scatter grid honours the spec axis showGridLines - #10371
Conversation
The scatter branch hard-coded its CartesianGrid as vertical={false}, so a
spec showGridLines on either axis was dropped. It now spreads the same
gridProps its cartesian siblings use; with no axis declaring the key the
grid renders byte-identically to before.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D486C1axmXnrkJMNUfz2eb
|
changeset-claim-re-read
|
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Fixes #9792
Clause-②: no
What
The scatter branch of
AdvancedChartImpldrew its grid from a hard-codedCartesianGrid vertical={false}literal. It now spreads the same derivedgridPropsthe bar/line/area and horizontal-bar branches spread. So a specshowGridLinesdeclared on either scatter axis is honoured:yAxis.showGridLines: falseremoves the horizontal lines, andxAxis.showGridLines: trueadds vertical ones.Premise re-derivation (the card's load-bearing claim, measured here, not taken from the card)
gridPropsis derived in the component body before anychartTypebranch returns, so it is already in scope in the scatter branch. Nothing was hoisted or re-derived.xAxisSpec(thexAxisprop) andprimaryY(yAxes[0]). These are the same two objects the scatter axes read since objectui#9675:numericAxisSpecProps(xAxisSpec, ...)on X andyAxisSpecProps(primaryY)on Y. There is no stale or secondxAxisobject.normalizeAxiscopiesshowGridLinesonly when it is a boolean and fills no default. So with no axisshowGridLines,gridPropsevaluates tovertical: false(undefined === true) andhorizontal: true(undefined !== false). That is the literal'svertical={false}plus recharts' own defaulthorizontal.g.recharts-cartesian-gridgroup's outerHTML: (a) no axes, (b)xAxis: { format }only, (c)yAxes: [{ min: 0 }]only. It did this once on the unfixed tree and once on the fixed tree.cmpreports the two dumps identical (2621 bytes each). The probe file was deleted and is not committed.Tests
New
packages/plugin-charts/src/AdvancedChartImpl.scatterGridLines-9792.test.tsxrenders the realAdvancedChartImplwith the sameResponsiveContainerbox mock the objectui#9675 and objectui#7396 scatter files use:yAxes[0].showGridLines: false: 0 horizontal lines.xAxis.showGridLines: true: vertical lines are present and horizontal lines are kept.Ablation. Run after committing the fix (head
32fd97245).ablation-replace.mjsput the literal back (anchor hit 1 time, blobef9b7eac75e5became16bc459a9baf). Result:Tests 2 failed | 1 passed (3), with case 2 and case 3 red and the control green. The restore was verified: the blob equals the HEAD blob andgit diff HEADis empty. The first attempt used an anchor that missed; the tool refused it and ran nothing.Local verification (at head
32fd97245)pnpm --filter '@object-ui/plugin-charts^...' build: exit 0pnpm exec vitest run packages/plugin-charts/(repo root):Test Files 67 passed (67),Tests 602 passed (602)type-check(tsc --noEmit && tsc -p tsconfig.test.json): exit 0. The new test file is in the test program (checked with--listFiles).lint(eslint .): exit 0, 0 errorscheck:vi-mock-specifiers,check:vi-mock-inherit,check:vi-mock-override-shape,check:test-path-roots,check:new-line-citations(0 new),check:control-bytes,check:changeset-claims,check:pending-changeset-literals,check:shell-escape-residue,check-changeset-presence.mjs,check-changeset-no-major.mjsAcceptance notes
check:changeset-claimsflagged one item for reading: the pending changeset7546-chart-series-keys-declared.mdnamesAdvancedChartImpl.tsx. I read that paragraph. It is about the series keys (label, and so on) and says nothing about the grid, so it is still true after this change..changeset/9792-scatter-grid-show-grid-lines.md, a patch bump for@object-ui/plugin-charts.Generated by Claude Code