Skip to content

fix(ux): no unsaved changes warning when canceling edit on detail pages #3344

@vanshaj2023

Description

@vanshaj2023

Issue description

On detail/edit pages (Upstreams, Routes, Services, etc.), clicking Cancel silently discards all unsaved form changes with no warning. Users can lose edits without realizing it.

Root cause
The Cancel button calls setReadOnly(true) directly with no unsaved changes check:

<Button variant="outline" onClick={() => setReadOnly(true)}>
  {t('form.btn.cancel')}
</Button>

Expected behavior

A confirmation dialog should appear when the user has unsaved changes, consistent with the plugin editor drawer which was fixed in #3333 .

How to Reproduce

  1. Go to Upstreams → open any upstream → click Edit
  2. Make changes to any field
  3. Click Cancel
  4. All changes are silently discarded, no confirmation dialog

Screenshots

No response

Environment

apisix-dashboard: master

Additional context

Affected pages

  1. Upstreams (upstreams/detail.$id.tsx)
  2. Routes (routes/detail.$id.tsx)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions