Skip to content

🐛 Fixed false unsaved warning in welcome email editor#29389

Merged
9larsons merged 1 commit into
mainfrom
codex/fix-welcome-email-dirty-state
Jul 16, 2026
Merged

🐛 Fixed false unsaved warning in welcome email editor#29389
9larsons merged 1 commit into
mainfrom
codex/fix-welcome-email-dirty-state

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

What changed

  • Treat keyboard and pointer activity as editor interaction instead of focus alone.
  • Keep initial Koenig normalization from marking an untouched welcome-email draft dirty.

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 passed
  • pnpm exec eslint src/components/settings/membership/member-emails/welcome-email-modal.tsx
  • pnpm exec tsc --noEmit in apps/admin-x-settings
  • Pre-commit ESLint, dependency-cruiser, secret scan, and submodule checks

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
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f2a75262-a893-442a-b42c-24bb4ab47b05

📥 Commits

Reviewing files that changed from the base of the PR and between 6682543 and a593496.

📒 Files selected for processing (1)
  • apps/admin-x-settings/src/components/settings/membership/member-emails/welcome-email-modal.tsx

Walkthrough

Updated 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: peterzimon, evanhahn, cmraible

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-welcome-email-dirty-state

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 16, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit a593496

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

@9larsons
9larsons marked this pull request as ready for review July 16, 2026 15:17
@9larsons
9larsons merged commit 2cebbb4 into main Jul 16, 2026
43 checks passed
@9larsons
9larsons deleted the codex/fix-welcome-email-dirty-state branch July 16, 2026 15:17
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.

1 participant