Uh oh!
There was an error while loading. Please reload this page.
fix(plugin-report): derive report chart category colours and order (objectui#4906) - #5310
Merged
Merged
Conversation
…bjectui#4906) Wires `buildOptionColorMap` and `buildCategoryOrder` (both already in `@object-ui/core`, already consumed by `DatasetWidget`) into the report chart path via `useDatasetDimensionMeta` — the exact chain the dashboard already runs for the same dimension, reused rather than re-derived. Authored `colors` (objectui#4877) keeps precedence, merged UNDER the derived per-category map exactly as `chartConfigPresentation` already does for the dashboard. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RV6yuVCxymHYE16PL9vQkE
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-support-ai
marked this pull request as ready for review
August 19, 2026 12:11
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Fixes#4906
What changed
A report chart derived neither its category dimension's option colours nor its declared category order — the same dimension on a dashboard chart got both. This wires
buildOptionColorMapandbuildCategoryOrder(@object-ui/core) into the report chart path viauseDatasetDimensionMeta, the exact chainDatasetWidget(plugin-dashboard) already runs for its own chart. Per the triage ruling, this is cross-surface convergence onto an already-ruled behaviour (framework#3588's declared-picklist-order ruling), not new capability — no changes topackages/core.This deliberately changes rendering — what visibly changes
For an existing report grouped by a select/lookup dimension:
colorsnow paints each category in that dimension's own option colour (e.g. ahealthdimension now paints its own green/amber/red) instead of the renderer's positional palette.funnel/pyramidchart now orders its stages by the field's declared picklist order instead of sorting by value.Precedence is unchanged: an authored
colorsrecord (objectui#4877) still wins over the derived per-category map —chartConfigPresentation's existing merge ({ ...fieldColors, ...authorColors }) already puts the author's map on top; the report path now just supplies the field-derived half it never used to.Where
packages/plugin-report/src/DatasetReportRenderer.tsx—DatasetReportChartnow callsuseDatasetDimensionMeta(not the label-onlyuseDatasetDimensionLabels) and derivescategoryColors/categoryOrderthe same wayDatasetWidget's ownuseMemodoes (localizeFieldOptions→buildOptionColorMap/buildCategoryOrder), passescategoryColorsaschartConfigPresentation's second argument, and spreadscategoryOrderonto the chart schema when derived.packages/plugin-report/src/useDatasetDimensionLabels.ts— re-exportsuseDatasetDimensionMeta(the locale-free half) alongside the existinguseDatasetDimensionLabels, since this is the one report call site that needs the metadata directly rather than only the label maps.packages/plugin-report/src/__tests__/DatasetReportRenderer.chartCategoryConvergence.test.tsx— new. Pins the derived colours, the declared order, the precedence, and — the deliverable's real proof — that the report path's output is the literal output of the same@object-ui/corecall chainDatasetWidgetis written to make, over the same picklist..changeset/dataset-chart-category-colors-and-order.md—patchon@object-ui/plugin-report.Why "converges with the dashboard" isn't a live side-by-side render
DatasetWidgetisplugin-dashboard's own internal implementation detail — it is not part of that package's public export surface (barrel orpackage.json#exports), the same shapeDatasetReportCharthas in this package. Reaching it from aplugin-reporttest would mean a deep, non-exported cross-package import that only resolves under this repo's root-vitestsrcalias and would not resolve at all throughplugin-dashboard's publisheddist(no./DatasetWidgetsubpath export) — plus a newplugin-report → plugin-dashboarddev dependency for one test. So the new test file pins convergence at the mechanism instead: the report chart's schema is asserted against the literal output oflocalizeFieldOptions→buildOptionColorMap/buildCategoryOrder— the exact chainDatasetWidget's ownuseMemois written to run — reproduced inline over the identical picklist, so agreement is provable rather than incidental.Verification
Re-derived on current
origin/main(de4e29a81, already includes #5304's CI fix) — no rebase needed.Rebuild question: all tests run via the canonical
pnpm exec vitest run packages/plugin-report/from repo root. The rootvitest.config.mtsaliases@object-ui/core,@object-ui/react, and@object-ui/plugin-reportdirectly to theirsrc/(not through packageexportstodist), sobuildOptionColorMap/buildCategoryOrder/useDatasetDimensionMetaresolve straight to source for this run — no stale-distrisk.Reverse verification (predictions written before running, in the new test file's own header comment):
git checkout de4e29a81 -- packages/plugin-report/src/DatasetReportRenderer.tsx packages/plugin-report/src/useDatasetDimensionLabels.ts(source only; new test file kept).its (2 green as decisions-not-pins: a pure fixture self-check that renders nothing, and the "no declared options →categoryOrderomitted" case, which held trivially before the fix too since the key was never spread under any input).git checkout claude/issue-4906-report-chart-option-colors --(the same two files);git statusclean against HEAD.Final commands, at HEAD
4bfb71054:(152 pre-existing + 9 new, all green.) Also ran, clean:
pnpm --filter '@object-ui/plugin-report^...' build,pnpm --filter '@object-ui/plugin-report' build(both succeed — no type errors),node scripts/check-control-bytes.mjs,node scripts/check-phantom-dependencies.mjs,node scripts/check-changeset-fixed.mjs,node scripts/check-changeset-no-major.mjs,node scripts/check-changeset-presence.mjs,pnpm exec eslinton the three changed source/test files (0 errors, pre-existing-pattern warnings only).Generated by Claude Code
Generated by Claude Code