fix(native-filters): stabilize DefaultValue's filterState object identity - #43859
Open
Kunal8954 wants to merge 1 commit into
Open
fix(native-filters): stabilize DefaultValue's filterState object identity#43859Kunal8954 wants to merge 1 commit into
Kunal8954 wants to merge 1 commit into
Conversation
…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
Contributor
Code Review Agent Run #923ad7Actionable 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 |
3 tasks
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.
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