You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem with multiple property spreads like <div {...props1} {...props2} />. If the element is locally styled and the second props object contains a class entry then the class is not applied.
Reversing the order of props spreading works: <div {...props2} {...props1} /> produces the correct result.
We are doing some compiler magic behind the scenes to make scoped classes work with spread attributes, but I don't think we considered multiple spreads. It's totally valid, we just haven't implemented it yet.
As a workaround, you can always explicitly pass class since you know where it's coming from.
This happens because these two spreads end up injecting two class attributes. The second class attribute is removed by the browser to correct the markup.
I'll take a look
What version of
astro
are you using?1.0.0-rc.7
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
There is a problem with multiple property spreads like
<div {...props1} {...props2} />
. If the element is locally styled and the second props object contains aclass
entry then the class is not applied.Reversing the order of props spreading works:
<div {...props2} {...props1} />
produces the correct result.Link to Minimal Reproducible Example
https://stackblitz.com/edit/astro-multi-spread-props-problem
Participation
The text was updated successfully, but these errors were encountered: