Skip to content

Fix plugin:activate and plugin:deactivate not called on setPluginStatus#394

Merged
ascorbic merged 3 commits intoemdash-cms:mainfrom
datienzalopez:fix/plugin-activate-deactivate-not-called-on-status-change
Apr 11, 2026
Merged

Fix plugin:activate and plugin:deactivate not called on setPluginStatus#394
ascorbic merged 3 commits intoemdash-cms:mainfrom
datienzalopez:fix/plugin-activate-deactivate-not-called-on-status-change

Conversation

@datienzalopez
Copy link
Copy Markdown
Contributor

What does this PR do?

setPluginStatus (called when enabling/disabling a plugin via the admin UI) rebuilt the hook pipeline but never invoked the plugin:activate or plugin:deactivate lifecycle hooks. This meant plugins relying on plugin:activate to schedule cron tasks or run setup logic would never see that hook fire.

The fix follows the same ordering used by PluginManager.activate/deactivate:

  • plugin:deactivate fires on the current pipeline before the plugin is removed (while it's still registered)
  • plugin:activate fires on the new pipeline after rebuild (while the plugin is now included)

Closes #

Type of change

  • Bug fix

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm --silent lint:json | jq '.diagnostics | length' returns 0
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset (if this PR changes a published package)

AI-generated code disclosure

  • This PR includes AI-generated code

Screenshots / test output

✓ tests/unit/plugins/pipeline-rebuild.test.ts (8 tests) 25ms
Tests  2156 passed (2156)

setPluginStatus rebuilt the hook pipeline but never called the lifecycle
hooks, so plugin:activate and plugin:deactivate were silently skipped
whenever a plugin was enabled or disabled via the admin UI.

Now plugin:deactivate fires on the current pipeline (while the plugin is
still registered) before it is removed, and plugin:activate fires after
the pipeline is rebuilt with the plugin included — matching the sequence
used by PluginManager.activate/deactivate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@datienzalopez
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 8, 2026
@datienzalopez
Copy link
Copy Markdown
Contributor Author

recheck

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 11, 2026

🦋 Changeset detected

Latest commit: 706d71c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-ai-moderation Patch
@emdash-cms/plugin-atproto Patch
@emdash-cms/plugin-audit-log Patch
@emdash-cms/plugin-color Patch
@emdash-cms/plugin-embeds Patch
@emdash-cms/plugin-forms Patch
@emdash-cms/plugin-webhook-notifier Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Collaborator

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 11, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@394

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@394

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@394

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@394

emdash

npm i https://pkg.pr.new/emdash@394

create-emdash

npm i https://pkg.pr.new/create-emdash@394

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@394

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@394

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@394

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@394

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@394

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@394

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@394

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@394

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@394

commit: 706d71c

@ascorbic ascorbic merged commit 391caf4 into emdash-cms:main Apr 11, 2026
25 checks passed
@emdashbot emdashbot bot mentioned this pull request Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants