Skip to content

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

Open
datienzalopez wants to merge 1 commit intoemdash-cms:mainfrom
datienzalopez:fix/plugin-activate-deactivate-not-called-on-status-change
Open

Fix plugin:activate and plugin:deactivate not called on setPluginStatus#394
datienzalopez wants to merge 1 commit intoemdash-cms:mainfrom
datienzalopez:fix/plugin-activate-deactivate-not-called-on-status-change

Conversation

@datienzalopez
Copy link
Copy Markdown

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
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
Author

recheck

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.

1 participant