Skip to content

fix(ux): show unsaved changes warning on cancel in route and upstream…#3355

Open
vanshaj2023 wants to merge 1 commit into
apache:masterfrom
vanshaj2023:fix/unsaved-changes-detail-pages
Open

fix(ux): show unsaved changes warning on cancel in route and upstream…#3355
vanshaj2023 wants to merge 1 commit into
apache:masterfrom
vanshaj2023:fix/unsaved-changes-detail-pages

Conversation

@vanshaj2023
Copy link
Copy Markdown
Contributor

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

What changes will this PR take into?

When editing a Route or Upstream and clicking Cancel, all unsaved form changes were silently discarded with no warning. This PR adds a confirmation dialog (same pattern as #3333) that appears only when the form has unsaved changes.

  • Added handleCancel in routes/detail.$id.tsx and upstreams/detail.$id.tsx that checks form.formState.isDirty before closing
  • If dirty → shows "Unsaved Changes" confirmation modal with Discard/Cancel options
  • If clean → closes silently without modal
  • Added info.unsaved.* i18n keys across all 5 locales (en, zh, de, es, tr)

Note: form.formState.isDirty is reliable here because form.reset(fetchedData) is called after data loads, correctly setting defaultValues. This is different from #3333 where direct value comparison was needed.

Related issues

fix #3344

Checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@vanshaj2023
Copy link
Copy Markdown
Contributor Author

Hi @Baoyuantop ,
Please review this.

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.

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

1 participant