hussnainahmedd opened a new pull request, #710: URL: https://github.com/apache/shenyu-dashboard/pull/710
## Description Closes #608 On the TCP Discovery page, `isPluginEnabled` was initialized to `false` and only ever updated by the toggle/edit handlers — the page never read the actual enabled flag. So on initial load the plugin showed as closed even when enabled, and the first toggle click sent `enabled: true` for an already-enabled plugin. ## Changes `src/routes/Plugin/Discovery/index.js` only: - Added `syncPluginEnabled`, which derives `isPluginEnabled` from `plugins.find(p => p.name === pluginName)?.enabled`, mirroring the pattern in `src/routes/Plugin/Common/index.js` and `src/routes/Plugin/McpServer/index.js` (where `getAllSelectors` sets the state the same way). - `componentDidMount`: sync from the `plugins` prop when it is already loaded. - `componentDidUpdate`: sync whenever the `plugins` prop changes (covers the list arriving after `global/fetchPlugins` completes, and namespace switches). The toggle handler now inverts the real status, so the first click sends the correct value. The tag and switch rendering are unchanged — they already read `this.state.isPluginEnabled`. ## Validation - `npx eslint src/routes/Plugin/Discovery/index.js` — 0 errors, 0 warnings. - Logic re-read: state reflects the server-side plugin status before any toggle; the toggle callback's optimistic update is not clobbered (the `plugins` reference does not change on toggle). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
