-
Notifications
You must be signed in to change notification settings - Fork 4.1k
4259 Fix option not being rebuild after isOptionDisabled prop changes #4349
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
4259 Fix option not being rebuild after isOptionDisabled prop changes #4349
Conversation
|
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 0fc0401:
|
b2b65b6
to
cc0596b
Compare
packages/react-select/src/Select.js
Outdated
@@ -378,7 +379,8 @@ export default class Select extends Component<Props, State> { | |||
|
|||
return isEqual(newSelectValue, lastSelectValue) | |||
&& isEqual(newProps.inputValue, lastProps.inputValue) | |||
&& isEqual(newProps.options, lastProps.options); | |||
&& isEqual(newProps.options, lastProps.options) | |||
&& newProps.isOptionDisabled === lastProps.isOptionDisabled; |
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.
If we're going to add functions to the memoization we should also include isOptionSelected
, getOptionLabel
, getOptionValue
, filterOption
, etc.
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.
I've added these and some other comparisons which are needed for rebuilding menu options. Do you expect to have tests for each of these? I've added one for the original issue.
…ecked using new function when isOptionDisabled prop changes
…ions whenever different option props are passed
63d053c
to
2818847
Compare
@manvydasu Thanks for your work on this PR! We decided to actually take a different option and remove the memoization altogether (#4388) since we don't think it's realistic to maintain the memoization as it currently stands. We really appreciate your work on this and hope this solution works for you! |
#4259
This makes sure that options are being rebuilt whenever isOptionDisabled prop changes. The prop itself was not included into memoized option rebuild condition