You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "vanshaj2023 (via GitHub)" <gi...@apache.org> on 2026/03/20 23:23:35 UTC
[I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
vanshaj2023 opened a new issue, #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344
### 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
<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`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "vanshaj2023 (via GitHub)" <gi...@apache.org>.
vanshaj2023 commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4101435265
#3333
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "moonming (via GitHub)" <gi...@apache.org>.
moonming commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4932692229
This was fixed by #3391 (`c8d3466`) and I verified the coverage on current `master` (`9979b31`): every detail page now wires Cancel through `useEditCancelGuard`, which shows an unsaved-changes confirm before discarding.
Checked all 12 detail pages individually (routes, services, upstreams, consumers, credentials, ssls, protos, secrets, stream_routes, global_rules, plugin_configs, consumer_groups) — each contains `const handleCancel = useEditCancelGuard(form, () => setReadOnly(true));` — plus the two nested service sub-pages which inherit it by reusing `RouteDetail`/`StreamRouteDetail`. No remaining Cancel path calls `setReadOnly(true)` directly.
This can be closed. Two related gaps worth tracking separately (not blockers for this issue):
1. The guard deliberately shows the modal on **every** Cancel — including when nothing was changed — because the current `disabled`-toggling form architecture makes `isDirty` unreliable (documented in `useEditCancelGuard.tsx`'s own comment). Fixing the dirty signal would remove one needless click per clean cancel.
2. Browser-level exits are still unguarded: navigating away via the sidebar, browser Back, or closing the tab with a dirty form discards everything silently (`useBlocker`/`beforeunload` appear nowhere in `src/`). That's the most common real-world data-loss path and deserves its own issue — I'm filing a review-summary issue that includes it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "Jaswanth-arjun (via GitHub)" <gi...@apache.org>.
Jaswanth-arjun commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4124298576
Hi @vanshaj2023 ,
Nice catch on extending the fix from #3333 to detail pages.
One small suggestion: since this logic is being reused across multiple places, would it make sense to extract the unsaved changes check into a reusable hook or utility? This could help avoid duplication and ensure consistency across all edit flows.
Just a thought — happy to hear your opinion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "vanshaj2023 (via GitHub)" <gi...@apache.org>.
vanshaj2023 commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4126488648
Hi @Baoyuantop, understood! I will combine the changes so that both areas are handled in a single PR.
Hi @Jaswanth-arjun, thank you for the suggestion! I'm also considering extracting the unsaved changes logic into a reusable hook/utility for better consistency.
@Baoyuantop, would you prefer that approach, or should I just focus on combining the fixes without refactoring?
Once we're aligned, I'll submit the updated PR shortly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4118750999
Hi @vanshaj2023, why do you need to submit #3355 after submitting #3333? Aren't they solving the same problem?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4124003516
Hi @vanshaj2023, I believe this is the same function, and we should complete it in a single PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "vanshaj2023 (via GitHub)" <gi...@apache.org>.
vanshaj2023 commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4122173494
Hi @Baoyuantop, they fix the same type of bug but in different places.
PR #3333 fixed the Plugin Editor Drawer, while PR #3355 applies the exact same fix to the main Detail/Edit pages (Upstreams, Routes, etc.) where changes were still being silently discarded.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "vanshaj2023 (via GitHub)" <gi...@apache.org>.
vanshaj2023 commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4101432192
Hi @Baoyuantop ,
I noticed the same issue that we fixed in #3333
Do I do the same thing here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop closed issue #3344: fix(ux): no unsaved changes warning when canceling edit on detail pages
URL: https://github.com/apache/apisix-dashboard/issues/3344
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "vanshaj2023 (via GitHub)" <gi...@apache.org>.
vanshaj2023 commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4101434154
#3333
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] fix(ux): no unsaved changes warning when canceling edit on detail pages [apisix-dashboard]
Posted by "vanshaj2023 (via GitHub)" <gi...@apache.org>.
vanshaj2023 commented on issue #3344:
URL: https://github.com/apache/apisix-dashboard/issues/3344#issuecomment-4114159286
Hi @Baoyuantop,
Sorry for submitting a PR without waiting for a discussion first.
I went ahead and opened PR #3355 because this is the exact same issue we just resolved in #3333, so I applied the same established pattern here.
Let me know if you need any changes!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org