Skip to content

Scenario preset editor loses unsaved edits on navigation without a prompt #4279

Open

Description

Describe the bug

The scenario preset editor silently discards unsaved edits when the user navigates away or refreshes. There is no route blocker and no beforeunload guard, unlike the sibling suite editor and the conversation and configuration editors, which all confirm before discarding.

Steps/Code to Reproduce

  1. Open an existing preset for editing, for example /registry/scenario-presets/nightly_probe/edit.
  2. Change the description, pick different techniques, or change dataset options.
  3. Click any sidebar item, press browser Back, or refresh the tab.
# the guard pair exists in exactly three editors; the preset editor is not one of them
# frontend/src/components/Configuration/Configuration.tsx          useBlocker + useBeforeUnload
# frontend/src/components/Chat/ConversationEditor.tsx              useBlocker + useBeforeUnload
# frontend/src/components/ScenarioSuites/ScenarioSuiteEditor.tsx   useBlocker + useBeforeUnload
# frontend/src/components/ScenarioPresets/ScenarioPresetEditor.tsx (none)

Expected Results

A discard confirmation dialog blocks in-app navigation while edits are pending, and the browser asks for confirmation before unloading, mirroring ScenarioSuiteEditor.

Actual Results

All edits are lost immediately with no prompt, including large ones (scenario selection, parameters, datasets, techniques, name, description).

Screenshots

Not applicable.

Versions

OS: macOS
Browser: any
Python version: 3.13
PyRIT version: main at 165bdbd

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