Skip to content

console: deleting an environment variable does not reach the draft, and Discard leaves edited rows on screen #244

Description

@trifonnt

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions