OBPIH-6014 Fix async select dropdown to be wider for longer labels#4482
Merged
awalkowiak merged 3 commits intofeature/product-supplier-list-redesignfrom Jan 31, 2024
Merged
Conversation
drodzewicz
approved these changes
Jan 29, 2024
Collaborator
drodzewicz
left a comment
There was a problem hiding this comment.
Looks good but fix the hook state name
| const dropdownWidth = inputContainerWidth > currentDropdownWidth | ||
| ? inputContainerWidth | ||
| : currentDropdownWidth; | ||
| const [drpWidth, setDtrWidth] = useState(undefined); |
Collaborator
There was a problem hiding this comment.
Suggested change
| const [drpWidth, setDtrWidth] = useState(undefined); | |
| const [dropdownWidth, setDropdownWidth] = useState(undefined); |
| style={{ | ||
| ...style, | ||
| width: dropdownWidth, | ||
| width: drpWidth, |
Collaborator
There was a problem hiding this comment.
Suggested change
| width: drpWidth, | |
| width: dropdownWidth, |
awalkowiak
reviewed
Jan 31, 2024
| <Dropdown inputContainerRec={inputContainer.getBoundingClientRect()} > | ||
| <Dropdown | ||
| inputContainerRec={inputContainer.getBoundingClientRect()} | ||
| hasOptions={!!props.options.length} |
Collaborator
There was a problem hiding this comment.
Are props.options required? Is it possible it will be null? Should it be a part of propTypes?
Collaborator
Author
There was a problem hiding this comment.
options prop from the react-select is an empty array by default.
awalkowiak
approved these changes
Jan 31, 2024
awalkowiak
pushed a commit
that referenced
this pull request
Mar 12, 2024
…4482) * OBPIH-6014 Fix async select dropdown to be wider for longer labels * OBPIH-6014 Change state name to dropdownWidth (fix after review) * OBPIH-6014 Add prop type for the options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The point was to re-create the dropdown and its width when the options change, because before for the async select, the width has never dynamically changed regarding the options that were loaded.
Thanks for pair programing @drodzewicz @alannadolny