Repository navigation
fix: reactive Activate/Deactivate buttons in plugin-list (closes #179) - #204
Merged
Merged
Conversation
After clicking the Activate or Deactivate button on a plugin row in an ability_result message, the button label and target action would stay frozen at the original state. So an activate click left an "Activate" button on a now-active plugin — clicking it again hit "plugin is already active" instead of deactivating it. Fix: extract the inline button JSX in MessageItem into a small <ActionButton> component that tracks its own loading state and, for known mutual-inverse action pairs (plugin-activate ↔ plugin-deactivate), flips to the inverse after a successful click. Same plugin slug in args, just opposite ability + label. Loading state shows '…' on the button and disables it while the action runs. handleAction in ChatContainer now returns the action result so ActionButton can read result.success and only flip on real successes (failed activations don't lie about the state). The INVERSE_ACTIONS map is the single source of truth — adding a new reversible pair (e.g. enable/disable theme) only needs an entry there. Tests: 96 passing, unchanged. Build: clean. Lint: clean (two pre-existing ChatContainer warnings are not from this PR). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After clicking the Activate (or Deactivate) button on a plugin row in an `ability_result` message, the button label and its target action would stay frozen at the original state. So an Activate click left an "Activate" button on a now-active plugin — clicking it again hit "plugin is already active" instead of deactivating it.
Net: +71 / -20 lines, 2 files touched.
What changed
`MessageItem.jsx`
```js
const INVERSE_ACTIONS = {
'wp-agentic-admin/plugin-activate': { action: 'plugin-deactivate', button_label: 'Deactivate' },
'wp-agentic-admin/plugin-deactivate': { action: 'plugin-activate', button_label: 'Activate' },
};
```
`ChatContainer.jsx`
Behavior matrix
Verification
Manual test plan
🤖 Generated with Claude Code