Repository navigation
fix(StructuredSelector): seed declared defaults for accessor-chain bindings - #1339
Merged
Merged
Conversation
…ndings (#1337) A {bind} object writes the prop's declared default (Field emptyValue, LineGraph active, Slider to, ...) to the store when the widget initializes. Accessor chains wrote nothing, so a chain-bound field held undefined instead of null, a chain-bound LineGraph was not drawn, and a chain-bound Slider positioned its handle at NaN% and wrote NaN on mouse wheel. Chains now collect the declared default like binding objects do. Existing store values are never overwritten, and chains nested inside structured props get no default.
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.
Fixes #1337.
A
{bind}object writes the prop's declared default to the store when the widget initializes. Accessor chains wrote nothing, so the result depended on how the binding was written:undefinedinstead of itsemptyValue(null)LineGraph(or another chart element withactive) was not drawn until toggledSliderpositioned its handle atNaN%and wroteNaNto the store on mouse wheel#1336 and #1338 added specs and a litmus page that reproduce this.
Fix
StructuredSelector.getSelectorConfignow collects the declared default for accessor chains, the same way it does for binding objects (2 lines). Existing store values are never overwritten. Thev != pvguard keeps a chain nested inside a structured prop (style={{ color: m.x }}, where props and values are the same object) from writing the chain function itself as its default.Tests
With the fix applied, the four accessor-chain cases from #1338 failed, because the store now held the default. They now assert the intended behavior:
active = trueand draws its line. A storedfalseis kept for both binding styles.0with its handle at0%, the mouse wheel steps it to1, and an existing value is kept.null(or a customemptyValue), and existing values are not overwritten.defaultValueon the binding wins over the declared one, and chains nested in structured props get none.558 passing,
check-typesclean. The text on the litmus pagebugs/FieldBindingObjectNullSeedingnow describes the fixed behavior. In the browser, both columns now match for all three widgets.Behavior change
This changes what apps that use accessor chains find in the store, so it ships as 26.10.0 with an entry in
breaking-changes.mdx. The entry lists every affected widget and prop, and what to check when upgrading:=== undefinedcomparisons and"key" in datachecksnullkeys that now appear in JSON sent to a server$recordeditors inside aGridorRepeater, which now write the default into each record they renderCommits
fix(StructuredSelector): …: the fix, specs, litmus page, breaking-changes entryBump cx version to 26.10.0:package.jsonand changelog🤖 Generated with Claude Code