Added warning when leaving automation editor with unsaved edits#28045
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughAdds a new React hook useConfirmUnload that conditionally registers a window beforeunload listener (calling event.preventDefault() and setting event.returnValue = ''), cleans it up on dependency change or unmount, re-exports the hook from admin-x-framework entrypoints, adds unit tests covering registration, handler behavior, toggling, and unmount cleanup, and integrates the hook into AutomationEditor using isEditRequestActive || hasUnsavedChanges. Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
000a808 to
36fe149
Compare
This comment was marked as outdated.
This comment was marked as outdated.
closes https://linear.app/ghost/issue/NY-1297 Before this change, publishers could leave the automations editor (e.g., by closing the browser tab) when their draft had unsaved changes or when an edit request was active. Now, they get a browser-level warning message. This is the best we can do to keep them on the page. (Note that we plan to add in-app confirmation dialogs in other places, such as when you click the in-app back button. This is related but separate.)
36fe149 to
6f291c3
Compare
E2E Tests FailedTo view the Playwright test report locally, run: REPORT_DIR=$(mktemp -d) && gh run download 26238439252 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR" |
E2E Tests FailedTo view the Playwright test report locally, run: REPORT_DIR=$(mktemp -d) && gh run download 26238439252 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR" |
closes https://linear.app/ghost/issue/NY-1297
Screencast.mp4
Before this change, publishers could leave the automations editor (e.g., by closing the browser tab) when their draft had unsaved changes or when an edit request was active.
Now, they get a browser-level warning message. This is the best we can do to keep them on the page.
(Note that we plan to add in-app confirmation dialogs in other places, such as when you click the in-app back button. This is related but separate.)