Skip to content

Document {bind}-object emptyValue store seeding with spec and litmus repro - #1336

Merged
nebojsa-peric merged 1 commit into
masterfrom
repro/master/binding-object-emptyvalue-seeding
Oct 7, 2026
Merged

nebojsa-peric merged 1 commit into
masterfrom
repro/master/binding-object-emptyvalue-seeding

Conversation

@nebojsa-peric

@nebojsa-peric nebojsa-peric commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Form fields initialize their store slot differently depending on how the value binding is authored:

  • A binding object (value={{ bind: "..." }}, including the value-bind shorthand) seeds the path with the field's declared emptyValue (null) the moment the widget initializes — StructuredSelector.getSelectorConfig collects the declared prop default into defaultValues and init() writes it to the store.
  • An accessor-chain binding (value={model.x}) takes the isAccessorChain branch, which registers no default, so the slot stays undefined until the user interacts.

An untouched field therefore leaves null or undefined in the store based solely on binding style. Any code that strict-compares such a slot — e.g. disabled={expr(m.a, m.b, (a, b) => a === b)} with two empty slots — flips its result after a seemingly cosmetic refactor from {bind: ...} to an accessor chain, which is how we ran into this.

This PR adds a spec (Field value binding initialization, 4 cases — including one showing the seeded value follows a custom emptyValue, pinning down the mechanism) and a litmus page (bugs/FieldBindingObjectNullSeeding) with a live store dump. No behavior changes — the spec documents the current semantics; whether the asymmetry is intended is up for discussion.

@nebojsa-peric

Copy link
Copy Markdown
Collaborator Author

Tracking the fix in #1337.

@nebojsa-peric
nebojsa-peric merged commit 3b127b8 into master Oct 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant