Skip to content

Remove comments UI action any types#28851

Merged
9larsons merged 3 commits into
TryGhost:mainfrom
PedroMarianoAlmeida:fix-comments-ui-actions-any-types
Jun 25, 2026
Merged

Remove comments UI action any types#28851
9larsons merged 3 commits into
TryGhost:mainfrom
PedroMarianoAlmeida:fix-comments-ui-actions-any-types

Conversation

@PedroMarianoAlmeida

@PedroMarianoAlmeida PedroMarianoAlmeida commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Please take a minute to explain the change you're making:

  • Why are you making it?
    • apps/comments-ui/src/actions.ts had several explicit any types in action payloads and dispatcher casts. This PR removes them so the action layer is better typed.
  • What does it do?
    • Types addReply with AddComment and Comment.
    • Adds optional reply fields (parent_id, in_reply_to_id) to AddComment, matching how reply creation already uses that payload shape.
    • Replaces the SyncActions as any lookup with Object.prototype.hasOwnProperty.call.
    • Types ActionHandler and SyncActionHandler payloads from the existing Actions / SyncActions maps instead of accepting data: any.
    • Removes adminApi from hideComment and showComment parameter annotations because those functions never destructure or read that argument; they use state.adminApi instead, so deleting the unused parameter type is safe and does not change runtime behavior.
  • Why is this something Ghost users or developers need?
    • This reduces untyped action plumbing in comments-ui and catches incorrect action payloads earlier for developers working on comments.

Please check your PR against these items:

  • I've read and followed the Contributor Guide
  • I've explained my change
  • I've written an automated test to prove my change works (NA - typecheck only)

Testing

  • CI=true pnpm --filter @tryghost/comments-ui exec eslint src/actions.ts src/app-context.ts
  • CI=true pnpm --filter @tryghost/comments-ui exec tsc --noEmit
    • I ran this before and after the changes. It still fails on the documented package-wide baseline in tasks/comments-ui-tsc-types.md, but the after result is cleaner: the previous src/actions.ts errors are gone and actions.ts no longer appears in the failure list.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

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: 5c2e8536-c7bd-47be-a625-2c4a6a18a6c9

📥 Commits

Reviewing files that changed from the base of the PR and between 1597986 and c8b95b4.

📒 Files selected for processing (3)
  • apps/comments-ui/package.json
  • apps/comments-ui/src/actions.ts
  • apps/comments-ui/src/app-context.ts
✅ Files skipped from review due to trivial changes (1)
  • apps/comments-ui/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/comments-ui/src/app-context.ts
  • apps/comments-ui/src/actions.ts

Walkthrough

AddComment in app-context.ts gains parent_id and in_reply_to_id. In actions.ts, addReply, hideComment, and showComment use narrower payload types, and the dispatch layer adds action-to-payload maps plus generic ActionHandler and SyncActionHandler signatures. The package version in package.json is updated from 1.5.16 to 1.5.17.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing any types from comments UI action handling.
Description check ✅ Passed The description clearly matches the code changes and explains the typing cleanup, payload updates, and validation performed.
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 unit tests (beta)
  • Create PR with unit tests

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.

@9larsons 9larsons left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nx-cloud

nx-cloud Bot commented Jun 25, 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 ad73781

Command Status Duration Result
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 1s View ↗
nx run @tryghost/comments-ui:test:acceptance ✅ Succeeded 47s View ↗
nx run-many -t test:unit -p @tryghost/comments-ui ✅ Succeeded 12s View ↗
nx run @tryghost/admin:build ✅ Succeeded 5s View ↗
nx run-many -t lint -p @tryghost/comments-ui ✅ Succeeded 5s View ↗
nx run ghost:build:assets ✅ Succeeded 2s View ↗
nx run ghost:build:tsc ✅ Succeeded 6s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-25 19:04:32 UTC

Changelog for v1.5.14 -> 1.5.17:
@9larsons 9larsons force-pushed the fix-comments-ui-actions-any-types branch from f0309bf to 1597986 Compare June 25, 2026 18:53
# Conflicts:
#	apps/comments-ui/package.json
@9larsons 9larsons force-pushed the fix-comments-ui-actions-any-types branch from 1597986 to c8b95b4 Compare June 25, 2026 18:57
@9larsons 9larsons enabled auto-merge (squash) June 25, 2026 19:01
@9larsons 9larsons merged commit f0f97e8 into TryGhost:main Jun 25, 2026
38 checks passed
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.

2 participants