juzhiyuan commented on a change in pull request #1764:
URL: https://github.com/apache/apisix-dashboard/pull/1764#discussion_r615319850



##########
File path: web/src/components/Upstream/UpstreamForm.tsx
##########
@@ -86,14 +87,18 @@ const UpstreamForm: React.FC<Props> = forwardRef(
         if (required) {
           requestAnimationFrame(() => {
             form.resetFields();
-            form.setFieldsValue(DEFAULT_UPSTREAM);
             setHiddenForm(false);
           });
         }
       } else {
         if (upstream_id) {
           requestAnimationFrame(() => {
-            form.setFieldsValue(list.find((item) => item.id === upstream_id));
+            const targetData = list.find((item) => item.id === upstream_id) as 
UpstreamComponent.ResponseData
+            if (targetData) {
+              
form.setFieldsValue(transformUpstreamDataFromRequest(targetData));
+            } else {
+              // TODO: 提示 upstream_id 找不到想要的数据

Review comment:
       I just filed a PR to make the Upstream Logics more clear 
https://github.com/apache/apisix-dashboard/pull/1784, no need to check if 
target data lost any more.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to