fix(native-filters): allow clearing an optional "select first value" filter - #43405
Open
msyavuz wants to merge 1 commit into
Open
fix(native-filters): allow clearing an optional "select first value" filter#43405msyavuz wants to merge 1 commit into
msyavuz wants to merge 1 commit into
Conversation
…filter "Select first filter value by default" was treated as "Filter value is required" in checkIsMissingRequiredValue, so clearing such a filter disabled Apply and painted a required indicator on a filter configured as optional. This is most visible on a filter that depends on a parent, where the value appears to keep coming back. Claude-Session: https://claude.ai/code/session_01Xm8nAHR5aG2NJT3G77Hc2C
Contributor
Code Review Agent Run #2bbda4Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
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.
SUMMARY
A filter configured with Select first filter value by default: YES and Filter value is required: NO cannot be cleared:
checkIsMissingRequiredValuetreatsdefaultToFirstItemas if it wereenableEmptyFilter, so clearing the value disables Apply and shows a required indicator on a filter the user configured as optional. It reads as "the value keeps coming back", and is most visible on a filter that depends on a parent.defaultToFirstItemonly seeds an initial selection; onlyenableEmptyFilter("User must select a value before applying the filter") makes a value mandatory. Same change to the required-asterisk inFilterControl. Filters that are both required and default-first still block Apply, viaenableEmptyFilter.Also drops a dead effect in
SelectFilterPlugin— leftover from #34137, it computedhasDataChangedand then reset nothing.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — the visible difference is the Apply button's disabled state and a red
*, both covered by the added tests.TESTING INSTRUCTIONS
Country— required: YES, select first value by default: YES.State— required: NO, select first value by default: YES, Values are dependent on other filters: Country.Statewith the X.Stateshows a red required indicator and Apply stays disabled. After: no indicator, Apply is enabled, and applying leavesStateempty.Unit tests:
ADDITIONAL INFORMATION
defaultToFirstItemfiltershttps://claude.ai/code/session_01Xm8nAHR5aG2NJT3G77Hc2C