[dataquery] Clear operator when the filter field changes - #11031
Open
HenriRabalais wants to merge 1 commit into
Open
[dataquery] Clear operator when the filter field changes#11031HenriRabalais wants to merge 1 commit into
HenriRabalais wants to merge 1 commit into
Conversation
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.
Description
When you change the field on a filter, the Criteria operator dropdown keeps showing the operator you picked for the previous field. You can end up with an operator that is not valid for the new field, or have to re-click the same option when it is still valid.
FilterableSelectGroupwraps react-select without passing avalueprop, so react-select keeps the selected option in its own internal state. The fieldonChangealready callssetOp(null)andsetValue(''), which clears the parent state, but the dropdown itself never remounts so it keeps displaying the old operator.The field dropdown right above it already handles this by keying on the category. This does the same thing for the operator dropdown, keying it on the field name so it remounts when the field changes.
Changes
key={fieldname}to the operatorFilterableSelectGroupin the Add criteria modal, so it resets to the "Select an operator" placeholder whenever the field changes.Testing Instructions
<operator. A date input appears next to it.<, which is not a valid operator for an enum field.Related Issues
Resolves #10781