Version: main at 51c8356. ui/src/components/HarnessSettings.tsx, the environment editor added in #238.
Two defects in how the environment rows and the harness draft are kept in step.
1. Deleting a variable does not reach the draft
The delete handler updates envRows only. Dirty state and saving both read draft, so:
- delete a variable and nothing else → the page still says No unsaved changes, and there is nothing to save
- delete a variable, then edit any other field → saving writes
draft.env, which still contains the "deleted" variable, so it silently comes back
2. Discard Changes leaves the edited rows on screen
The rows are synchronized only when the harness id changes:
useEffect(() => { setEnvRows(Object.entries(draft?.env || {}).map(...)) }, [harnessId]);
"Discard Changes" replaces draft with saved under the same id, so the effect does not run: the discarded values stay visible while the form reports itself clean. Editing another row afterwards rebuilds draft.env from what is on screen, which resurrects the discarded values.
Fix shape: have the delete handler write draft.env as the other field handlers do, and synchronize the rows on the environment data rather than on the harness id (or reset rows and draft together).
Version:
mainat 51c8356.ui/src/components/HarnessSettings.tsx, the environment editor added in #238.Two defects in how the environment rows and the harness draft are kept in step.
1. Deleting a variable does not reach the draft
The delete handler updates
envRowsonly. Dirty state and saving both readdraft, so:draft.env, which still contains the "deleted" variable, so it silently comes back2. Discard Changes leaves the edited rows on screen
The rows are synchronized only when the harness id changes:
"Discard Changes" replaces
draftwithsavedunder the same id, so the effect does not run: the discarded values stay visible while the form reports itself clean. Editing another row afterwards rebuildsdraft.envfrom what is on screen, which resurrects the discarded values.Fix shape: have the delete handler write
draft.envas the other field handlers do, and synchronize the rows on the environment data rather than on the harness id (or reset rows and draft together).