Skip to content

Add LineGraph and Slider repros for {bind} vs accessor-chain default seeding - #1338

Merged
nebojsa-peric merged 1 commit into
masterfrom
repro/master/default-seeding-charts-slider
Oct 7, 2026
Merged

nebojsa-peric merged 1 commit into
masterfrom
repro/master/default-seeding-charts-slider

Conversation

@nebojsa-peric

Copy link
Copy Markdown
Collaborator

Follow-up to #1336, for #1337. That PR only covered form fields. The same gap affects every widget prop with a declared default: a {bind} object writes that default to the store, and an accessor chain leaves it undefined. With charts and sliders, that does more than change the stored value. It changes what you see and what gets saved:

  • LineGraph (active: true): a series bound with active={m.$page.show} isn't drawn while the store is empty, because LineGraph renders nothing when active is falsy. The same series bound with {bind} is drawn. The legend shows the hidden series as on, and clicking it draws the series (the toggle writes !undefined, which is true).
  • Slider (to: 0): a chain-bound slider calculates its handle position from undefined and renders left: NaN%. The browser ignores that value, so the handle only looks right by accident. Scrolling the mouse wheel writes NaN to the store (undefined + step).

Changes

  • charts/LineGraph.spec.tsx, 4 cases: {bind} draws the line and stores true; the chain stores nothing and draws no line; the legend entry still shows as on; the chain draws once the store holds true. react-test-renderer has no DOM for the Svg to measure, so the spec uses a small FixedSizeSvg subclass with a fixed size.
  • widgets/form/Slider.spec.tsx, 4 cases: the handle position (0% vs NaN%) and the mouse wheel step (1 vs NaN). It uses createNodeMock to capture the wheel listener.
  • litmus/bugs/FieldBindingObjectNullSeeding: rebuilt so it explains itself. TextField, LineGraph and Slider each appear side by side with both binding styles, with a live readout of each store value and notes on what you should see and what actually happens.

No behavior changes. Like #1336, the specs check the current behavior, and the fix PR will update them to the intended behavior.

🤖 Generated with Claude Code

Accessor-chain bindings don't get the declared prop default written to the
store, unlike {bind} objects. A chain-bound LineGraph starts hidden
(active undefined) and a chain-bound Slider positions its handle at NaN%
and writes NaN on mouse wheel. The specs pin down the current behavior;
the litmus page shows each widget side by side with both binding styles.
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