Skip to content

Report short configs; keep a chart's failure in its place - #680

Merged
byronwall merged 1 commit into
claude/standalone-charts-docs-retirefrom
claude/standalone-charts-short-configs
Nov 20, 2026
Merged

byronwall merged 1 commit into
claude/standalone-charts-docs-retirefrom
claude/standalone-charts-short-configs

Conversation

@byronwall

@byronwall byronwall commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

A host now gets short configs back from onConfigChange: the type, its main field, and only the settings that differ from the defaults. Before this, it got every setting. One chart's failure also stays in that chart: a config that cannot draw shows why in its place, and the rest of the page keeps working.

What you'll see

  • onConfigChange gives { type: "scatter", xField: "Price", yField: "Rating", display: "hexbin" } instead of the full settings object with axes, margins, and defaults.
  • <Chart config={{ type: "nonsense" }} /> shows "This chart can't draw: Chart type nonsense not registered" in its place. Before, it threw, and React unmounted the whole host page.
  • The docs say "short config" where they said "whole config".

Proof

pnpm --filter exploreda exec vitest run src/chart
 Tests  67 passed (67)
  • shortConfig.test.tsx runs every one of the 27 chart types: the short config redraws a chart identical to the full one (same settings, compared as sorted JSON), and it is shorter.
  • A second test puts a bad chart beside a good one: the bad one shows an alert, and the good one still draws its SVG.
  • A probe before this change: {type:"nonsense"} threw Chart type nonsense not registered out of render. Five other bad configs (unknown fields, a heatmap with the same field twice) already showed the chart's own empty message.

No screenshot: the visible change is one line of text in place of a chart.

Stack: standalone charts, layer 7 of 9

This slice: short configs and the per-chart error boundary.
Why it is its own layer: both change library behavior that hosts rely on, apart from the builder above that uses them.
Full story: #673

🤖 Generated with Claude Code

onConfigChange now reports the type, its main field, and only the
settings that differ from the type's defaults. A test proves the short
form redraws the identical chart for every chart type. An error boundary
around each Chart and ChartSettings shows why a config cannot draw, such
as a mistyped type, instead of unmounting the host page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@byronwall
byronwall added this pull request to stack #676 November 20, 2026 04:46
@byronwall
byronwall marked this pull request as ready for review November 20, 2026 05:19
@byronwall
byronwall merged commit fd82628 into main Nov 20, 2026
6 checks passed
@byronwall
byronwall deleted the claude/standalone-charts-short-configs branch November 20, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant