shenyu-dashboard icon indicating copy to clipboard operation
shenyu-dashboard copied to clipboard

[BUG] TCP Discovery page shows stale plugin status and the first toggle sends enabled: true

Open dengliming opened this issue 2 months ago • 1 comments

Description

isPluginEnabled starts as false in state and is only ever updated by the toggle handlers. Unlike src/routes/Plugin/Common/index.js and src/routes/Plugin/McpServer/index.js, which derive it from the plugins prop in getAllSelectors, the Discovery page never reads the actual enabled flag.

Location

(The initialization and toggle paths below are still present in the current snapshot.)

  • src/routes/Plugin/Discovery/index.js:74 (initial state)
  • src/routes/Plugin/Discovery/index.js:152-159 (enabled = !this.state.isPluginEnabled)
  • src/routes/Plugin/Discovery/index.js:535-538 (tag rendering)

Impact

On initial load, the TCP plugin page shows the plugin as closed even when it is enabled; clicking the switch the first time sends enabled: true for an already-enabled plugin (or, after a page refresh where the real state is enabled, the displayed state is simply wrong).

Suggested fix

Initialize isPluginEnabled from plugins.find(p => p.name === pluginName)?.enabled in componentDidMount/componentDidUpdate, mirroring Common/index.js.

Related existing

None

Verified source

Rechecked against Dashboard fed203e and, where applicable, ShenYu Admin 31e0c3e on 2026-09-26.

dengliming avatar Sep 24 '26 06:09 dengliming

Hi, I'd like to work on this issue. I'll initialize isPluginEnabled from the plugins prop in the Discovery page, mirroring the pattern used in Common/index.js and McpServer/index.js, so the page reflects the actual plugin status and the first toggle sends the correct value.

hussnainahmedd avatar Oct 02 '26 07:10 hussnainahmedd