Skip to content

feat: show popup unsaved changes leaves page - #2141

Merged
cre8ivejp merged 1 commit into
mainfrom
feat-show-popup-unsaved-changes-leaves-page
Oct 30, 2025
Merged

feat: show popup unsaved changes leaves page#2141
cre8ivejp merged 1 commit into
mainfrom
feat-show-popup-unsaved-changes-leaves-page

Conversation

@steveninhle

@steveninhle steveninhle commented Sep 26, 2025

Copy link
Copy Markdown
Collaborator

Fix #2343

@steveninhle
steveninhle marked this pull request as ready for review September 29, 2025 14:27
@steveninhle
steveninhle force-pushed the feat-show-popup-unsaved-changes-leaves-page branch from b1fa1cc to 544b3a5 Compare October 9, 2025 05:19
@steveninhle
steveninhle requested a review from t-kikuc as a code owner October 9, 2025 05:19
Comment thread ui/dashboard/src/@locales/ja/common.json Outdated
@steveninhle
steveninhle force-pushed the feat-show-popup-unsaved-changes-leaves-page branch from 544b3a5 to 7150bef Compare October 28, 2025 02:24

@t-kikuc t-kikuc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented on japanese translations

Comment thread ui/dashboard/src/@locales/ja/common.json Outdated
Comment thread ui/dashboard/src/@locales/ja/common.json Outdated
@steveninhle
steveninhle force-pushed the feat-show-popup-unsaved-changes-leaves-page branch from 7150bef to df75b69 Compare October 28, 2025 02:50
Comment thread ui/dashboard/src/@locales/en/message.json Outdated
Comment thread ui/dashboard/src/@locales/en/common.json Outdated
Comment thread ui/dashboard/src/@locales/ja/message.json Outdated
@cre8ivejp
cre8ivejp requested review from Copilot and removed request for kakcy October 28, 2025 08:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useUnsavedLeavePage hook 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.

Comment thread ui/dashboard/src/utils/function.ts Outdated
Comment thread ui/dashboard/src/utils/function.ts Outdated
Comment thread ui/dashboard/src/@locales/en/message.json Outdated
Comment thread ui/dashboard/src/pages/organizations/page-loader.tsx Outdated
Comment thread ui/dashboard/src/pages/organizations/page-loader.tsx Outdated
Comment thread ui/dashboard/src/pages/goals/goals-modal/add-goal-modal/index.tsx Outdated
add warning unsaved change when leave page for setting

fix: logic show drawer add and update

feat: show popup unsaved changes leaves page
@steveninhle
steveninhle force-pushed the feat-show-popup-unsaved-changes-leaves-page branch from df75b69 to 273d08e Compare October 29, 2025 01:36

@cre8ivejp cre8ivejp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🎉

@cre8ivejp
cre8ivejp merged commit c3d7cd7 into main Oct 30, 2025
3 checks passed
@cre8ivejp
cre8ivejp deleted the feat-show-popup-unsaved-changes-leaves-page branch October 30, 2025 02:42
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.

feat: show popup for unsaved changes when leaving pages

4 participants