fix plugin toggle signature and sync UI via modal events
Backend: Update toggle_plugin signature to match API Frontend: use x-on:modal-closed in the Plugin List to auto-refresh state, ensuring the "Advanced" dropdown status updates immediately without manual store calls
Alessandro committed
Feb 25, 2026 at 12:51 UTC
dfc76a2aafc47809e6c35bf5b5094d6c90c6a21c
4 files changed
+19
-4
python/helpers/plugins.py
+16
-1
@@ -305,8 +305,23 @@ def get_toggle_state(plugin_name: str) -> ToggleState:
305
306
307
def toggle_plugin(
308
- plugin_name: str, enabled: bool, project_name: str = "", agent_profile: str = ""
308
+ plugin_name: str,
309
+ enabled: bool,
310
+ project_name: str = "",
311
+ agent_profile: str = "",
312
+ clear_overrides: bool = False,
313
):
314
+ if clear_overrides:
315
+ all_toggles = find_plugin_assets(
316
+ TOGGLE_FILE_PATTERN,
317
+ plugin_name=plugin_name,
318
+ project_name="*",
319
+ agent_profile="*",
320
+ only_first=False,
321
+ )
322
+ for toggle in all_toggles:
323
+ files.delete_file(toggle["path"])
324
+
325
enabled_file = determine_plugin_asset_path(
326
plugin_name, project_name, agent_profile, ENABLED_FILE_NAME
327
)
webui/components/plugins/list/plugin-list.html
+1
-1
@@ -7,7 +7,7 @@
7
</head>
8
9
<body>
10
- <div x-data>
10
+ <div x-data x-on:plugin-modal-closed.window="$store.pluginListStore.refresh()">
11
<template x-if="$store.pluginListStore">
12
<div x-init="$store.pluginListStore.init && $store.pluginListStore.init()">
13
webui/components/plugins/plugin-settings.html
+1
-1
@@ -9,7 +9,7 @@
9
<div x-data>
10
<template x-if="$store.pluginSettings">
11
<div x-create="$store.pluginSettings.onModalOpen()"
12
- x-destroy="$store.pluginSettings.cleanup()">
12
+ x-destroy="$store.pluginSettings.cleanup(); $dispatch('plugin-modal-closed')">
13
14
<!-- Context toolbar: Project + Agent profile (only when at least one scope is configurable) -->
15
<div class="plugin-settings-scope-section"
webui/components/plugins/toggle/plugin-toggle-advanced.html
+1
-1
@@ -9,7 +9,7 @@
9
<div x-data>
10
<template x-if="$store.pluginToggle">
11
<div x-create="$store.pluginToggle.open($store.pluginListStore?.selectedPlugin || '')"
12
- x-destroy="$store.pluginToggle.cleanup()">
12
+ x-destroy="$store.pluginToggle.cleanup(); $dispatch('plugin-modal-closed')">
13
14
<!-- Error -->
15
<div x-show="$store.pluginToggle.error" class="plugin-settings-error">