List tab: deleting an item brings back edits made to other items #235

Closed
opened 2026-09-26 14:37:16 +02:00 by meleki · 1 comment
Owner

In the List tab, edit the value of an item (a new or an existing one), then delete another item: every edit made since the rows were last built is reset.

Cause: ListAccess.value (src/editor/list/slot.ts) is read once when the tab builds its rows. An item edit does not rebuild the rows, so the delete button filters the list as it was at build time and writes that back. The kind picker of a row and the field buttons of a struct item (retype, rename, remove, + Field) hold the same stale item.

Fix: value is re-read on every access, and the struct item buttons read the item at click time.

In the List tab, edit the value of an item (a new or an existing one), then delete another item: every edit made since the rows were last built is reset. Cause: `ListAccess.value` (`src/editor/list/slot.ts`) is read once when the tab builds its rows. An item edit does not rebuild the rows, so the delete button filters the list as it was at build time and writes that back. The kind picker of a row and the field buttons of a struct item (retype, rename, remove, `+ Field`) hold the same stale item. Fix: `value` is re-read on every access, and the struct item buttons read the item at click time.
Author
Owner

Fixed in 085e6c8.

Cause
The list tab read the list once when it built its rows (ListAccess.value in src/editor/list/slot.ts). Editing a value does not rebuild the rows, so the × button later filtered that old copy and wrote it back. Every edit since the last rebuild was lost. Adding an item only triggered it: adding rebuilds the rows, and that state became the old copy.

Fix

  • value is read on every access.
  • The kind switch of a row and the struct field buttons (field type, rename, remove field, + Field) had the same stale copy of the item. They now read it when clicked.
  • New test hook __gm.list.removeAt(i).

Tests

  • ./check.sh: 2435 tests, CHECK EXIT 0.
  • Unit test in tests/editor/list-slot.test.ts: one access, edit a value, add and edit an item, delete another. All edits stay. Fails without the fix.
  • e2e 21b-ii with real clicks: set row 2 to 66, delete row 0, expect ["11","66"], two undos take both back. e2e 21: 52 checks passed.
  • Counter probe with the old snapshot: the check fails with ["11","44"], the reported bug.
  • Not covered by a test of their own: the struct field buttons and the kind switch after an edit.
  • e2e total is now 1400 (README and wiki Development, a861f8c), counted, not measured. CI was not awaited.
Fixed in 085e6c8. **Cause** The list tab read the list once when it built its rows (`ListAccess.value` in `src/editor/list/slot.ts`). Editing a value does not rebuild the rows, so the `×` button later filtered that old copy and wrote it back. Every edit since the last rebuild was lost. Adding an item only triggered it: adding rebuilds the rows, and that state became the old copy. **Fix** - `value` is read on every access. - The kind switch of a row and the struct field buttons (field type, rename, remove field, `+ Field`) had the same stale copy of the item. They now read it when clicked. - New test hook `__gm.list.removeAt(i)`. **Tests** - `./check.sh`: 2435 tests, CHECK EXIT 0. - Unit test in `tests/editor/list-slot.test.ts`: one access, edit a value, add and edit an item, delete another. All edits stay. Fails without the fix. - e2e 21b-ii with real clicks: set row 2 to 66, delete row 0, expect `["11","66"]`, two undos take both back. e2e 21: 52 checks passed. - Counter probe with the old snapshot: the check fails with `["11","44"]`, the reported bug. - Not covered by a test of their own: the struct field buttons and the kind switch after an edit. - e2e total is now 1400 (README and wiki *Development*, a861f8c), counted, not measured. CI was not awaited.
admin added this to the Development project 2026-09-27 11:28:31 +02:00
admin moved this to Done in Development on 2026-09-27 11:29:02 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: meleki/feuerwerk#235