Fix passing of strokeWidth
prop from Bar
to Rect
/Spline
components
#316
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.
Try passing a
strokeWidth
prop for aBarChart
'sbars
and you'll notice that nothing changes:but add
radius: 0
to the mix and suddenly things do change as expected:This was due to
Bar
passing itsstrokeWidth
prop toRect
/Spline
viastroke-width={strokeWidth}
(instead of the providedstrokeWidth
props):This bug was hidden for non-rounded bars (i.e.
radius = 0
) due toRect
passing{...$$restProps}
to<rect … />
, which would make the unexpectedstroke-width
prop still override the undefinedstrokeWidth
prop:Notice how the
Spline.svelte
component doesn't pass{...$$restProps}
to<path …/>
, so thestroke-width
rest-prop passed fromBar
never makes it to the<path …/>
element.This looks like two bugs in disguise of one to me:
Bar
should forward itsstrokeWidth
prop via{strokeWidth}
, rather thanstroke-width={strokeWidth}
.Spline
should forwards its{...$$restProps}
to its<path>
element as that's what basically all the other basic graphic primitive components do as well.