Variables: Fix multi value picker leaving the variable out of sync when clearing - #1631
Merged
Merged
Conversation
…lection VariableValueSelectMulti keeps the selection in local state and commits it on blur, then relies on a state change from the variable to re-sync. changeValueTo rewrites an empty selection back to the default and early-returns when that rewrite equals the value the variable already had, so nothing is published and the picker keeps rendering the empty local state while the variable still holds its old value. Re-sync the local state from the variable after committing.
… edit ends Instead of re-reading the variable after committing, the local state now means "there is an edit in flight" rather than "a copy of the value". It is undefined whenever the user is not mid-edit, and the picker renders the variable's value directly, so the two cannot drift apart and the variable is free to reject or rewrite what gets committed.
Clicking the clear button does not focus the input, so onBlur never fired and the clear was never committed: the picker showed the placeholder while the variable, the URL and the panels kept the previous values.
ivanortegaalba
requested review from
harisrozajac and
mdvictor
and removed request for
a team
August 27, 2026 16:16
# Conflicts: # packages/scenes/src/variables/components/VariableValueSelect.test.tsx
grafakus
approved these changes
Aug 28, 2026
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.
Clearing every selected value left the picker and the variable disagreeing.
onBlurnever fired and the clear was never committed: the picker showedSelect valuewhile the variable, the URL and the panels kept the previous values. The clear is now committed on change.Falling back to
All(or to the first option whendefaultToAllis false) on an empty selection is unchanged.