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
Fix animated multi-value select width bug #5376
Conversation
🦋 Changeset detectedLatest commit: 436e250 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 436e250:
|
bc15f11
to
61a6965
Compare
b89fbc8
to
528284f
Compare
Easiest solution would have been to enforce flex layout if |
528284f
to
00238f1
Compare
Thanks @Rall3n, I've updated this PR to be much simpler now that I know what the root cause is 😅 |
Description
This PR fixes #5251 (where the width of selected item in a multi-value select could sometimes be far too wide if it was animated).
As an added bonus this refactors a class component into a function component.
Since useEffect fires after the first paint, the width that we get from
getBoundingClientRect
should always be correct.Before:
React.Select.Animated.Width.Bug.Before.mp4
After:
React.Select.Animated.Width.Bug.After.mp4
In my testing I couldn't reliably reproduce the bug — before I made the changes, most of the time I could get bug to happen, but not always (you can see in the video about that it doesn't happen on my first attempt). After making the changes I haven't been able to reproduce it. I'm reasonably confident that this is fixed, but some extra eyes on this would be appreciated.