fix(editor): stop unsaved dialog flicker#1116
Merged
Merged
Conversation
Prevent the unsaved changes dialog from reopening while the router blocker is still transitioning after cancel. Add end-to-end coverage for the cancel path so the dialog cannot briefly reappear without failing tests.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a UX issue in the editor where the “unsaved changes” dialog can briefly reopen (“flicker”) after the user cancels navigation while the router blocker is still transitioning, and adds E2E coverage to prevent regressions.
Changes:
- Add a one-shot suppression flag in
useNavigationGuardto prevent reopening the unsaved-changes dialog immediately after cancel/reset. - Adjust
DialogManagerstate retention effect dependencies. - Add Playwright E2E coverage for the cancel path, plus a page-object helper for clicking the cancel button.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ui/leafwiki-ui/src/features/editor/useNavigationGuard.tsx | Suppresses the unsaved-changes dialog from reopening during the blocker transition after cancel. |
| ui/leafwiki-ui/src/components/DialogManager.tsx | Updates the dialog retention effect dependency list. |
| e2e/tests/page.spec.ts | Adds an E2E test ensuring cancel keeps the editor open without dialog flicker/reopen. |
| e2e/pages/EditPage.ts | Adds a page-object helper to click the unsaved-changes cancel button. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Prevent the unsaved changes dialog from reopening while the router blocker is still transitioning after cancel.
Add end-to-end coverage for the cancel path so the dialog cannot briefly reappear without failing tests.