feat: show popup unsaved changes leaves page - #2141
Merged
Merged
Conversation
steveninhle
marked this pull request as ready for review
September 29, 2025 14:27
steveninhle
requested review from
cre8ivejp,
hvn2k1,
kakcy and
nnnkkk7
as code owners
September 29, 2025 14:27
steveninhle
force-pushed
the
feat-show-popup-unsaved-changes-leaves-page
branch
from
October 9, 2025 05:19
b1fa1cc to
544b3a5
Compare
cre8ivejp
reviewed
Oct 28, 2025
steveninhle
force-pushed
the
feat-show-popup-unsaved-changes-leaves-page
branch
from
October 28, 2025 02:24
544b3a5 to
7150bef
Compare
t-kikuc
reviewed
Oct 28, 2025
t-kikuc
left a comment
Contributor
There was a problem hiding this comment.
I commented on japanese translations
steveninhle
force-pushed
the
feat-show-popup-unsaved-changes-leaves-page
branch
from
October 28, 2025 02:50
7150bef to
df75b69
Compare
cre8ivejp
reviewed
Oct 28, 2025
cre8ivejp
reviewed
Oct 28, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR implements a feature to show a confirmation popup when users attempt to leave a page with unsaved changes. The implementation includes a new custom hook useUnsavedLeavePage that intercepts navigation events and browser back/forward actions, prompting users to confirm before discarding their work.
Key changes:
- Created a reusable
useUnsavedLeavePagehook with a global confirmation provider - Integrated unsaved changes detection across 30+ forms and modals throughout the application
- Updated routing to support URL-based modal state management for better UX
Reviewed Changes
Copilot reviewed 51 out of 51 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
ui/dashboard/src/hooks/use-unsaved-leave-page.tsx |
New hook implementation with context provider for managing unsaved changes popup |
ui/dashboard/src/hooks/use-action-with-url.tsx |
Enhanced URL-based modal detection logic to properly identify edit states |
ui/dashboard/src/app/index.tsx |
Wrapped app with ConfirmProvider and updated routing structure |
ui/dashboard/src/utils/function.ts |
Added checkFiledDirty utility to recursively check dirty fields in nested objects |
ui/dashboard/src/pages/user-segments/user-segment-modal/segment-create-update-form/segment-warning.tsx |
Fixed missing slash in URL path construction |
| Multiple form/modal files | Integrated useUnsavedLeavePage hook and added type="button" to cancel buttons |
| Locale files | Added translations for unsaved changes messages in English and Japanese |
ui/dashboard/src/@queries/environments-details.ts |
New query hook for fetching environment details |
ui/dashboard/src/@api/environment-result/environment-result-details.ts |
New API endpoint for environment detail fetching |
Comments suppressed due to low confidence (1)
ui/dashboard/src/@locales/ja/common.json:1
- Missing space after colon in JSON formatting.
{
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
add warning unsaved change when leave page for setting fix: logic show drawer add and update feat: show popup unsaved changes leaves page
steveninhle
force-pushed
the
feat-show-popup-unsaved-changes-leaves-page
branch
from
October 29, 2025 01:36
df75b69 to
273d08e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #2343