🐛 Fixed false unsaved warning in welcome email editor#29389
Conversation
ref https://linear.app/ghost/issue/PLA-243 - editor autofocus can happen before initial content normalization completes - track keyboard and pointer interaction so normalization alone does not dirty the draft
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated the welcome email modal to track explicit editor interaction instead of focus. Keyboard and pointer events mark the editor as interacted with, while change handling preserves initial normalization content and compares later lexical content against the normalized baseline to determine dirty state. Suggested reviewers: ✨ 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 |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:test:acceptance |
✅ Succeeded | 4m 13s | View ↗ |
nx run-many -t test:unit -p @tryghost/admin-x-s... |
✅ Succeeded | 2m 51s | View ↗ |
nx run @tryghost/admin-x-settings:test:acceptance |
✅ Succeeded | 3m 21s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 20s | View ↗ |
nx run-many -t lint -p @tryghost/admin-x-settin... |
✅ Succeeded | 1m 4s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 41s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | 1s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-16 14:35:53 UTC

What changed
Root cause
The modal can autofocus the Koenig editor before its initial
{name}template normalization finishes. The previous focus-based heuristic then treated the normalization callback as a user edit, causing an unexpected unsaved-changes confirmation and making the migrated Admin acceptance test flaky.Impact
Closing an untouched welcome-email editor no longer shows an unsaved-changes warning. Real keyboard and pointer edits still mark the draft dirty.
Validation
pnpm exec vitest run -c vitest.acceptance.config.ts src/settings/membership/member-welcome-emails.acceptance.test.tsx— 26 passedpnpm exec eslint src/components/settings/membership/member-emails/welcome-email-modal.tsxpnpm exec tsc --noEmitinapps/admin-x-settings