Skip to content

Components changes on wrong component #24

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

Open
johanronn77 opened this issue Oct 3, 2023 · 0 comments
Open

Components changes on wrong component #24

johanronn77 opened this issue Oct 3, 2023 · 0 comments

Comments

@johanronn77
Copy link

johanronn77 commented Oct 3, 2023

Code:

<AddToCartButton/>
<ErrorMessage>This is an error</ErrorMessage>
const ErrorMessage= styled.div({
 .....
 });

Problem:

Within AddToCartButton we have another styled component:
const Base = styled.div({ display: 'inline-block', fontSize: 0, marginLeft: small });

The problem is that when the page is running the styles for Base is set on component ErrorMessage in its parent when page is rerendered.

AddToCartButton is with the class cz nb dd.
The one after is the ErrorMessage that is given the Base styling.

Before rerendering:
image

After rerendering:
image

ErrorMessage css:
image

Base component within AddToCartButton:
image

Note!
Within the AddToCartButton there is a Suspense that are adding an lazy loaded component (Tooltip). When removing the Suspense the problem is not happening.
image

Moving the ErrorMessage before the AddToCartButton is working as well.

Thanks for any answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant