Skip to content

Cleaned up automation edit state#28381

Draft
EvanHahn wants to merge 2 commits into
mainfrom
NY-1302
Draft

Cleaned up automation edit state#28381
EvanHahn wants to merge 2 commits into
mainfrom
NY-1302

Conversation

@EvanHahn
Copy link
Copy Markdown
Contributor

@EvanHahn EvanHahn commented Jun 4, 2026

closes https://linear.app/ghost/issue/NY-1302

This change should have no user impact.

This refactor should (hopefully) make things a bit easier to read.

closes https://linear.app/ghost/issue/NY-1302

This change should have no user impact.

This refactor should (hopefully) make things a bit easier to read.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 492356ed-72cb-492f-a0e6-ee930f6f5682

📥 Commits

Reviewing files that changed from the base of the PR and between 4f89c3a and c12f0b5.

📒 Files selected for processing (1)
  • apps/posts/src/views/Automations/editor.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/posts/src/views/Automations/editor.tsx

Walkthrough

This PR refactors the automation editor's edit-state state machine from string-based literals to a discriminated union { phase, action }. Types were updated to constrain actions per phase. The editor's state initializer, failure-detection helper, draft-change recovery, save() request/error mapping, mutation callbacks, alert/activity derivation, nested UI switch logic for buttons/variants, and confirm dialog/open-close handlers were all updated to read and set the new object-shaped states.

Possibly related PRs

  • TryGhost/Ghost#28111: Modifies the editState switch in the same editor.tsx area and may conflict with this refactor.
  • TryGhost/Ghost#28055: Updates save/edit flow and editState handling in editor.tsx/types.ts, overlapping this change.
  • TryGhost/Ghost#28113: Refactors editState flows for publish/republish/confirm in the same files, related to this restructure.

Suggested labels

ok to merge for me

Suggested reviewers

  • troyciesco
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: refactoring the automation edit state from string-based to object-based representation for improved clarity.
Description check ✅ Passed The description is related to the changeset, mentioning it's a refactor of automation edit state with no user impact and referencing a linear issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 NY-1302

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 and usage tips.

@EvanHahn EvanHahn marked this pull request as draft June 4, 2026 22:28
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