Amy0104 commented on code in PR #10731:
URL: https://github.com/apache/dolphinscheduler/pull/10731#discussion_r912817871


##########
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts:
##########
@@ -54,23 +53,20 @@ export function useEnvironmentName(
     return option.workerGroups.indexOf(model.workerGroup) !== -1
   }
 
-  watch(
-    () => options.value.length,
-    () => {
-      if (isCreate && options.value.length === 1 && !value.value) {
-        model.environmentCode = options.value[0].value
-      }
-      if (options.value.length === 0) model.environmentCode = null
-    }
-  )
-
   watch(
     () => model.workerGroup,
     () => {
       if (!model.workerGroup) return
       options.value = environmentList.filter((option: IEnvironmentNameOption) 
=>
         filterByWorkerGroup(option)
       )
+      // default environmentCode changing when workerGroup changed.
+      // if options only one. set the one as default.
+      if (options.value.length === 1) {
+        model.environmentCode = options.value[0].value
+      } else {
+        model.environmentCode = null
+      }

Review Comment:
   Data playback will get a problem. Such as you have two workerGroups A and B. 
And then set the workerGroup to B and set the environment to B-2.  Save the 
task, and reopen you will get the environment to B-1.



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