Summary
FormAutocomplete.svelte:591-601 clears the field's value (onChange('')) whenever a params-mapped dependency field's value changes. The clearing logic can't distinguish "user changed the dependency" from "external state arrived" (undo, redo, programmatic reset, collaborative edit), so any external change to a dependency cascades a value-clear on the dependent field.
Same architectural smell as #31: child component unilaterally mutating parent state on a dependency signal it can't fully interpret.
Repro
- Configure a Jira
create_issue node with dependent autocompletes: account → project → issue_type.
- Open the node, select an
account, then an issue_type. Workflow saves with both populated.
- Open the node config, change
account to a different value. issue_type clears (user-driven, correct).
- Press Ctrl+Z. Store reverts
account to the original. issue_type also clears — but it shouldn't, because the undone history snapshot had issue_type populated.
Net effect: undo of a dependency field corrupts the dependent field's value.
Why it's wrong
The child component is making a UI assumption ("the dependency changed → my value is stale") that doesn't hold when the dependency change comes from outside the form. The fingerprint diff in prevDepFingerprint only detects that the dependency changed, not who changed it.
Possible directions
-
Drop the value-clear from FormAutocomplete entirely. Keep the UI-state reset (abort fetch, clear suggestions cache) — that's genuinely the child's concern. Move the value-clear to the parent: a consumer that wants "when account changes, clear issue_type" can declare it explicitly (e.g. via a schema-level clearOnChange: ['account'] field, or by handling it in onChange). This is the architecturally clean answer but is a behavior change for existing consumers.
-
Opt-out flag. Add clearOnDependencyChange?: boolean to AutocompleteConfig, defaulting to true for back-compat. Node authors who store dependent values opt out.
-
Distinguish user-driven from external dependency changes. Track a "user just interacted with sibling" signal in the form context. Only fire the clear when the dependency change is preceded by sibling-focus. Brittle.
(1) is what I'd want for v2. (2) is shippable on v1.x as an escape hatch.
Scope
(1) is a v2-shaped change: invasive for current consumers. (2) is ~20 lines plus docs.
Related
Summary
FormAutocomplete.svelte:591-601clears the field's value (onChange('')) whenever aparams-mapped dependency field's value changes. The clearing logic can't distinguish "user changed the dependency" from "external state arrived" (undo, redo, programmatic reset, collaborative edit), so any external change to a dependency cascades a value-clear on the dependent field.Same architectural smell as #31: child component unilaterally mutating parent state on a dependency signal it can't fully interpret.
Repro
create_issuenode with dependent autocompletes:account→project→issue_type.account, then anissue_type. Workflow saves with both populated.accountto a different value.issue_typeclears (user-driven, correct).accountto the original.issue_typealso clears — but it shouldn't, because the undone history snapshot hadissue_typepopulated.Net effect: undo of a dependency field corrupts the dependent field's value.
Why it's wrong
The child component is making a UI assumption ("the dependency changed → my value is stale") that doesn't hold when the dependency change comes from outside the form. The fingerprint diff in
prevDepFingerprintonly detects that the dependency changed, not who changed it.Possible directions
Drop the value-clear from FormAutocomplete entirely. Keep the UI-state reset (abort fetch, clear suggestions cache) — that's genuinely the child's concern. Move the value-clear to the parent: a consumer that wants "when account changes, clear issue_type" can declare it explicitly (e.g. via a schema-level
clearOnChange: ['account']field, or by handling it inonChange). This is the architecturally clean answer but is a behavior change for existing consumers.Opt-out flag. Add
clearOnDependencyChange?: booleantoAutocompleteConfig, defaulting totruefor back-compat. Node authors who store dependent values opt out.Distinguish user-driven from external dependency changes. Track a "user just interacted with sibling" signal in the form context. Only fire the clear when the dependency change is preceded by sibling-focus. Brittle.
(1) is what I'd want for v2. (2) is shippable on v1.x as an escape hatch.
Scope
(1) is a v2-shaped change: invasive for current consumers. (2) is ~20 lines plus docs.
Related