-
-
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
[Stack, system] Apply correct responsive styles if any custom breakpoints are provided #32913
[Stack, system] Apply correct responsive styles if any custom breakpoints are provided #32913
Conversation
Also, not complaining, but just wanted to say that TypeScript would have prevented this type of issue. 😁 |
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.
This is what I had in mind, sorry if it was not clear.
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.
Logic looks good 👍
Fixes #32214
First of all, a very intriguing bug.
See the following:
Particularly interesting, since the issue reporter was having a
small
custom breakpoint value and for other breakpoints properties it was not causing any issue.And if the input of
direction
orspacing
is a string inStack
(here it'sdirection="column"
), this particular line will evaluate totrue
due to it being a function as shown in the above image.The
String
object hassmall
method in it's prototype. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/small.It's wrong to access the property if the input is a string. So first we check that it's of type object, then only we create a custom base.
Same applies to
resolveBreakpointValues
function. So, it's also a regression from #29300.Before: https://codesandbox.io/s/peaceful-https-6iewi9?file=/src/Demo.tsx
Now: https://codesandbox.io/s/jolly-volhard-247y2y?file=/src/Demo.tsx