-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When combining child property spread w/ parent <style>
tag, the child's styles disappear
#659
Comments
I think the issue here is that we are passing the scoped style class to the child component. Not sure why the spread is being prioritized over the explicit class though. |
Ran into this as well (Astro v1.6.11). Another interesting aspect of this (and possible workaround): if the <button class="styled-button" {...props}>Styled Button here</button> |
mark |
related to #656 |
Thanks for investigating this @wulinsheng123. Transferring this over to the compiler repo so it can be tracked there. |
Finally circling back to this. I think we should probably pass all props as an object when there's a spread prop, to ensure that duplicate attributes are not generated. |
Do you still plan to work on this @bluwy ? |
Not for the foreseeable future yet. I actually didn't know I was assigned to this either 😅 I'll remove my assignment for now so feel free to take this if you like. But it's something I can also revisit in the future. |
What version of
astro
are you using?1.6.10
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Windows
Describe the Bug
When using a component that utilizes a spread operator to apply all styles:
And then apply a parent
<style>
tag:The styling of the child component (
StyledButton
) is disabled entirely. If you remove either the parent'sstyle
tag or the{...props}
spread, this issue goes away.Link to Minimal Reproducible Example
https://github.com/crutchcorn/astro-props-spread-style-bug
Participation
The text was updated successfully, but these errors were encountered: