Skip to content

FIX: disarm the finding dialog leave guard for an untouched edit - #4006

Open
Manohar Paturi (ManoharPaturi) wants to merge 3 commits into
microsoft:mainfrom
ManoharPaturi:fix/finding-dialog-edit-guard
Open

Manohar Paturi (ManoharPaturi) wants to merge 3 commits into
microsoft:mainfrom
ManoharPaturi:fix/finding-dialog-edit-guard

Conversation

@ManoharPaturi

Copy link
Copy Markdown
Contributor

Description

Fixes #4005

The unsaved changes guard treated the draft as clean only when every watched field was empty. An edit dialog opens prefilled with the finding's stored values, and a finding always carries a title, so the clean check could never pass: opening Edit and immediately refreshing or closing the tab produced the browser's leave site confirmation for a draft with no changes. Only severity was compared against its initial value; the other watched fields were checked for emptiness alone.

Each watched field now compares against the draft the dialog started with, so a create dialog with untouched fields stays disarmed exactly as before, and an untouched edit dialog is clean because it still equals the stored finding.

Tests and Documentation

Added a regression that opens an edit dialog with prefilled values, changes nothing, and asserts the beforeunload guard stays disarmed; it fails on main, where the guard arms from the first render. The severity only create case keeps its armed assertions. The dialog suite passes at 12 tests and tsc is clean.

No documentation change needed, so I did not run JupyText.

The clean check required every watched field to be empty, which a prefilled edit dialog never satisfies, so opening Edit and refreshing always warned about unsaved changes. Each watched field now compares against the draft the dialog started with.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@romanlutz Roman Lutz (romanlutz) self-assigned this Nov 7, 2026

@romanlutz Roman Lutz (romanlutz) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making an addition, but otherwise this looks great!

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editing a finding always warns about unsaved changes, even when nothing was touched

3 participants