dengliming commented on code in PR #671:
URL: https://github.com/apache/shenyu-dashboard/pull/671#discussion_r4111377044


##########
src/routes/Plugin/Discovery/ProxySelectorModal.js:
##########
@@ -113,8 +114,9 @@ class ProxySelectorModal extends Component {
             pluginHandles[0] = filteredArray;
             this.setState({ pluginHandleList: pluginHandles });
 
-            let defaultValue = handlerArray[0].defaultValue;
-            this.setState({ defaultValueList: defaultValue.split(",") });
+            this.setState({
+              defaultValueList: getDefaultValueList(handlerArray[0]),

Review Comment:
   [P2] Guard the render path when discoveryHandler is missing
   
   When pluginHandles[0] contains other fields (for example loadBalance) but no 
discoveryHandler, handlerArray is empty. This helper now safely returns [], but 
the callback still stores discoveryHandler: []. For a non-local discovery type, 
render() at lines 612–614 checks only discoveryHandler != null, reads 
discoveryHandler[0], and then dereferences item.checkRule. The modal therefore 
still crashes in the missing-handler scenario this PR intends to fix. Admin 
allows individual plugin handle definitions to be deleted, so the presence of 
other definitions does not guarantee this field exists.
   
   I reproduced the failure by running the actual component's initialization 
callback and render method with that handle list. Please guard 
discoveryHandler?.[0] before accessing its fields (or normalize the missing 
handler to null and skip its form section), and add a component-level 
regression test covering the render after the callback.



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