{#each list as item}
<SkeletonText paragraph lines={2} />
{/each}
the number of lines can carry over from the previous instance in the list. That is, in this example, the first instance will have 2 elements in rows, the second will have 4 and so on.
The reason is that rows is a reactive declaration, which will share its value with other members of the list. This behavior is a quirk of Svelte and not necessarily intuitive, but the number of lines is therefore not necessarily determined by the lines prop. I recommend inserting a
rows=[]
just after line 19.
Or possibly changing $:rows = [] to let rows = [] depending on expected use cases.
https://github.com/carbon-design-system/carbon-components-svelte/blob/a1c7d9bd7c0de5b7321f745b8b85dee5682728aa/src/SkeletonText/SkeletonText.svelte#L16-L26
In svelte lists e.g.
the number of lines can carry over from the previous instance in the list. That is, in this example, the first instance will have 2 elements in
rows
, the second will have 4 and so on.The reason is that
rows
is a reactive declaration, which will share its value with other members of the list. This behavior is a quirk of Svelte and not necessarily intuitive, but the number of lines is therefore not necessarily determined by the lines prop. I recommend inserting arows=[]
just after line 19.
Or possibly changing
$:rows = []
tolet rows = []
depending on expected use cases.