apache / apache/apisix-dashboard
fix(ux): no unsaved changes warning when canceling edit on detail pages
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 617
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 1
Description
### 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:
```ts
setReadOnly(true)}>
{t('form.btn.cancel')}
```
### 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`)
Contributor guide
Research direction
Start by reading upstreams/detail.$id.tsx and routes/detail.$id.tsx, then compare their Cancel handling with the plugin editor drawer changes in #3333. Reproduce the edit-and-cancel flow on both affected pages and verify that a confirmation appears only when changes are unsaved and that confirmed cancellation discards them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100