Skip to content

fix(native-filters): allow clearing an optional "select first value" filter - #43405

Open
msyavuz wants to merge 1 commit into
apache:masterfrom
msyavuz:msyavuz/fix/clear-dependent-default-first-filter
Open

fix(native-filters): allow clearing an optional "select first value" filter#43405
msyavuz wants to merge 1 commit into
apache:masterfrom
msyavuz:msyavuz/fix/clear-dependent-default-first-filter

Conversation

@msyavuz

@msyavuz msyavuz commented Aug 21, 2026

Copy link
Copy Markdown
Member

SUMMARY

A filter configured with Select first filter value by default: YES and Filter value is required: NO cannot be cleared: checkIsMissingRequiredValue treats defaultToFirstItem as if it were enableEmptyFilter, 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.

// before — FilterBar/utils.ts
const isRequired =
  !!filter.controlValues?.enableEmptyFilter ||
  !!filter.controlValues?.defaultToFirstItem;

// after
const isRequired = !!filter.controlValues?.enableEmptyFilter;

defaultToFirstItem only seeds an initial selection; only enableEmptyFilter ("User must select a value before applying the filter") makes a value mandatory. Same change to the required-asterisk in FilterControl. Filters that are both required and default-first still block Apply, via enableEmptyFilter.

Also drops a dead effect in SelectFilterPlugin — leftover from #34137, it computed hasDataChanged and 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

  1. On any dataset, add a native Value filter Country — required: YES, select first value by default: YES.
  2. Add a second native Value filter State — required: NO, select first value by default: YES, Values are dependent on other filters: Country.
  3. Clear State with the X.
  4. Before: State shows a red required indicator and Apply stays disabled. After: no indicator, Apply is enabled, and applying leaves State empty.

Unit tests:

cd superset-frontend && npx jest \
  src/dashboard/components/nativeFilters/FilterBar/utils.test.ts \
  src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.test.tsx \
  src/filters/components/Select/SelectFilterPlugin.test.tsx

ADDITIONAL INFORMATION

  • Has associated issue: No
  • Required feature flags: None
  • Changes UI — the required indicator and Apply button state for defaultToFirstItem filters
  • Includes DB Migration: No — frontend only
  • Introduces new feature or API: No
  • Removes existing feature or API: No

https://claude.ai/code/session_01Xm8nAHR5aG2NJT3G77Hc2C

…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
@dosubot dosubot Bot added change:frontend Requires changing the frontend dashboard:native-filters Related to the native filters of the Dashboard labels Aug 21, 2026
@bito-code-review

bito-code-review Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2bbda4

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: 6b31e6b..6b31e6b
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/utils.test.ts
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/utils.ts
    • superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
    • superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend dashboard:native-filters Related to the native filters of the Dashboard size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant