fix: make prop-derived chart values reactive (Area label position, Sparkline series type)#3311
Open
rajanpanth wants to merge 2 commits into
Open
fix: make prop-derived chart values reactive (Area label position, Sparkline series type)#3311rajanpanth wants to merge 2 commits into
rajanpanth wants to merge 2 commits into
Conversation
Area computed its default label position from swapXY and Sparkline its series type from type with plain let declarations, so both froze at mount-time values while their consumers are reactive: toggling swapXY left area labels falling back to 'top' instead of 'right', and changing a sparkline's type from bar to line kept rendering bars. Same class as the BarChart stacked100 fix (evidence-dev#3310): derive with $: so the reactive consumers see current values.
rajanpanth
requested a deployment
to
Approval required to run action on external PR
July 24, 2026 04:30 — with
GitHub Actions
Waiting
Untruncated re-sweep of the viz tree found the identical pattern in Line.svelte (the earlier sweep output was truncated). _Chart's ySet/xSet are intentionally non-reactive per their in-code comment and stay as-is.
rajanpanth
requested a deployment
to
Approval required to run action on external PR
July 25, 2026 02:31 — with
GitHub Actions
Waiting
Author
|
Pushed a follow-up commit: an untruncated re-sweep of the viz tree found the identical pattern in |
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.
Sibling fix to #3310 — same bug class, found by sweeping the other viz components for it.
Problem
Two chart components derive values from props with plain
letdeclarations, freezing them at mount-time while their consumers are reactive:Area.svelte:let defaultLabelPosition = swapXY ? 'right' : 'top'— togglingswapXYafter mount leaves the reactivelabelPositionfallback stale (labels fall back totopon a swapped chart instead ofright)._Sparkline.svelte:let seriesType = type === 'area' ? 'line' : type—seriesTypeis consumed inside the$: tryconfig block, so mounting asbarand switching tolinekeeps rendering bars.Fix
Derive both with
$:so the reactive consumers see current values — the same one-line pattern as thestacked100fix in #3310. Changeset included (patch,@evidence-dev/core-components).Deliberately excluded from the sweep: the
isInitial/queryIDmount-time captures incore/*(intentionally non-reactive — they record initial state), and function-locallets.Note on tests: #3310 establishes the regression-spec pattern for this class on BarChart; these two are the same one-line derivation change. Happy to add per-component specs if you want them — Area mounts inside chart context, so I kept this PR surgical.