diff options
| author | Adam Malczewski <[email protected]> | 2026-08-20 20:37:17 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-08-20 20:37:17 +0900 |
| commit | ab693af7a22d979b96768a37e851c4835ae3fca3 (patch) | |
| tree | c7fc5167928d2fd2893e2f62aaa1880ad5ea1fa0 /src/features/layout/ui | |
| parent | 704c72625b1d2a531bab1bb29008d9af366ffe7b (diff) | |
| download | dispatch-web-ab693af7a22d979b96768a37e851c4835ae3fca3.tar.gz dispatch-web-ab693af7a22d979b96768a37e851c4835ae3fca3.zip | |
fix(named-agents): key editable rows by stable row key for uniqueness + save/remove identity
Draft rows (agent === null, id === null) previously keyed the other-names
exclusion and the live isNameTaken predicate by their nullable persisted id,
so a draft falsely collided with its OWN name (every name reported 'already
exists') and saving/removing one of multiple drafts could reconcile all of
them (a null agent captured identity matched every draft).
Identify rows solely by each Row's stable numeric `key` (already the
{#each} key) for: the other-names uniqueness hint, the controller's live
isNameTaken predicate, replaceAgent (save reconciliation), and removeRow.
A draft excludes itself exactly once; a persisted row keeps reconciling the
same row on later edits and no longer self-collides.
Add direct component-level regression tests (NamedAgentsView.test.ts) for
the self-collision, distinct/same-name multi-draft cases, saving-one-
updates-only-that-row, removing-one-removes-only-that-row, and post-persist
re-save reconciliation. 5 of 6 tests fail against the previous code (verified).
Verification: typecheck 0 errors, biome clean, 1252 tests pass, build ok.
Diffstat (limited to 'src/features/layout/ui')
0 files changed, 0 insertions, 0 deletions
