-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[system][createStyled] Intercept ownerState
coming from props
and ownerState
#42358
[system][createStyled] Intercept ownerState
coming from props
and ownerState
#42358
Conversation
ownerState
coming from props
and ownerState
Netlify deploy previewhttps://deploy-preview-42358--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
See Argos changes for the fixes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are few more lines where we handle this, e.g.
typeof callableStyle === 'function' ? callableStyle({ ownerState, ...props }) : callableStyle; |
processStyleArg(resolvedStyle, { ownerState, ...props }), |
Can we create a const at the top of the function and used that in all places?
@mnajdova I refactored by creating a const and added a test. For the occurrences you point out, there's no risk of overriding. The function signature is function processStyleArg(callableStyle, { ownerState, ...props }) So |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test, logic and argos look good to me 👌 We should port this logic to Pigment CSS too.
From #42345 (comment)
This resolves the styled symptoms of #42184 by not allowing
ownerState
values coming fromprops
orownerState
to override the component'sownerState
.It does not close #42184, as nested
ownerState
values are still being propagated.