dengliming opened a new issue, #612:
URL: https://github.com/apache/shenyu-dashboard/issues/612

   ## Description
   Many components call `JSON.parse` directly on free-form string columns 
coming from the admin API (`plugin.config`, `pluginHandle.extObj`, 
`rule.handle`, `selector.handle`, `instanceInfo`, `discovery.props`, 
`apiDoc.ext`/`document`, ...), often inside `render` or a column `render` 
function, with no `try/catch`. A single row whose value is not valid JSON (e.g. 
a plugin config saved as a plain string, or an empty string where `""` is not 
treated as empty) throws during render and unmounts the whole page.
   
   ## Location
   (Lines refer to `master @ 83969a5`.)
   - `src/routes/Home/index.js:143`
   - `src/routes/System/Plugin/index.js:400`, 
`src/routes/System/Plugin/AddModal.js:111,157`
   - `src/routes/System/NamespacePlugin/index.js:322`, 
`src/routes/System/NamespacePlugin/AddModal.js:45,118,164`
   - `src/routes/System/PluginHandle/index.js:152,350`
   - `src/routes/System/Instance/index.js:369` (also `text.length` throws when 
`text` is `undefined`)
   - `src/routes/Plugin/McpServer/index.js:183,577,1182,1207,1210` (every tool 
row's `handle`)
   - `src/routes/Plugin/Common/index.js:183`
   - `src/routes/Plugin/Common/Selector.js:127`
   - `src/routes/Plugin/PluginRuleHandle/HystrixRuleHandle.js:50`, 
`src/routes/Plugin/PluginRuleHandle/RequestRuleHandle.js:92`
   - `src/routes/Plugin/Discovery/DiscoveryCard.js:49`, 
`DiscoveryConfigModal.js:44,53,179`, `src/routes/Plugin/Discovery/index.js:406`
   - `src/routes/Document/components/AddAndUpdateApiDoc.js:48,306,383` (modal 
is `forceRender`, so it throws even while hidden)
   
   ## Impact
   One malformed record makes the Home page, the Plugin list, the McpServer 
tool table or the ApiDoc page render nothing; the user cannot even reach the 
row to fix it from the UI.
   
   ## Suggested fix
   Introduce a shared `safeJsonParse(str, fallback)` helper in 
`src/utils/utils.js` and use it at all of the above sites; for table columns 
fall back to rendering the raw text when parsing fails.
   
   ## Related existing
   None
   


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

Reply via email to