Skip to content

fix(native-filters): stabilize DefaultValue's filterState object identity - #43859

Open
Kunal8954 wants to merge 1 commit into
apache:masterfrom
Kunal8954:fix/native-filter-default-value-clears-on-type
Open

fix(native-filters): stabilize DefaultValue's filterState object identity#43859
Kunal8954 wants to merge 1 commit into
apache:masterfrom
Kunal8954:fix/native-filter-default-value-clears-on-type

Conversation

@Kunal8954

Copy link
Copy Markdown

DefaultValue.tsx rebuilds its filterState prop as a brand-new object literal on every render. That object flows down through SuperChart into the native filter plugin and ends up as the value prop of the underlying Select. Giving it a new identity on every render — including renders triggered by unrelated causes, since the config modal calls forceUpdate() after every dataMask change — is exactly the pattern flagged as the root cause in #43347's investigation.

This memoizes the object on its underlying source plus the two derived validation fields, so it keeps the same reference across renders that don't actually change anything.

Added DefaultValue.test.tsx with a regression test that fails without this fix (proven locally) and passes with it.

Fixes #43717

…tity

DefaultValue.tsx rebuilt its `filterState` prop as a brand new object
literal on every render:

    filterState={{
      ...formFilter?.defaultDataMask?.filterState,
      validateMessage: ...,
      validateStatus: ...,
    }}

That object flows down through SuperChart into the native filter plugin
and ultimately becomes the `value` prop of the underlying Select
component. Giving it a new identity on every render it any parent
re-render triggers (the config modal calls forceUpdate() after every
dataMask change, including pure search/ownState updates while the user
is typing) is exactly the pattern flagged as the root cause in apache#43347's
investigation: an unstable filterState reference feeding into a
component that treats identity changes as "the value changed".

Memoize the object on its underlying source plus the two derived
validation fields so it keeps the same reference across renders that
don't actually change anything, and only gets a new one when the value,
label, or validation state genuinely changes.

Fixes apache#43717

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kAvbZ6SeKgp6jbGcvpXSh
@bito-code-review

bito-code-review Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #923ad7

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 7e2db43..7e2db43
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DefaultValue.test.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DefaultValue.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native filter's Default Value field clears selections when typing a new value

1 participant