Commit 1b5e292
fix(widgets): reconcile widget store entry when widget type changes (#13774)
## Summary
On subgraph convert, a widget could render with the wrong type (a
multiline text widget appeared as an int widget until a page reload)
because the widget value store returned a stale entry keyed by
`graphId:nodeId:name`.
## Changes
- **What**: `registerWidget` returned the existing store entry
unconditionally (idempotent to preserve edited values across re-render).
But when a subgraph convert reuses the same `graphId:nodeId:name` key
for a *different* widget, the stale entry won — wrong type, wrong value,
only corrected by a reload that rehydrates the store from serialized
data. Now the idempotent return applies only when `existing.type ===
init.type`; on a type mismatch the id belongs to a different widget, so
the store overwrites with the live type/value. Same-type re-registration
still preserves edited values (unchanged behavior).
- **Breaking**: none.
## Review Focus
- @DrJKL @AustinMroz — this changes the idempotency semantic in the
#12617 widget store (#13073 collision class). The discriminator is
`type`; please sanity-check that no legitimate re-registration changes
`type` for the same logical widget. Reload already produces the correct
result, which is the evidence the in-memory path diverges here.
- Stacked on #13773 (base = `fix/widget-store-custom-node-widgets`).
Rebase to `main` once that lands.
QA source: staging 1.47 — "multiline text widget converts to int
inside/outside nested subgraph; refresh fixes it", working on 1.45.21.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent ba810e1 commit 1b5e292
2 files changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
115 | 130 | | |
116 | 131 | | |
117 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
0 commit comments