e2corporation commented on code in PR #3191:
URL: https://github.com/apache/incubator-devlake/pull/3191#discussion_r982329081


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -40,17 +40,25 @@ const Deployment = (props) => {
   useEffect(() => {
     setSelectValue(
       transformation?.deploymentPattern ||
-        transformation?.deploymentPattern === ''
+        transformation?.deploymentPattern === '' ||
+        transformation?.productionPattern ||
+        transformation?.productionPattern === ''
         ? 1
         : 0
     )
-  }, [transformation?.deploymentPattern])
+  }, [transformation?.deploymentPattern, transformation?.productionPattern])
 
   const handleChangeSelectValue = (sv) => {
     if (entityIdKey && sv === 0) {
-      onSettingsChange({ deploymentPattern: undefined }, entityIdKey)
+      onSettingsChange(
+        { deploymentPattern: undefined, productionPattern: undefined },

Review Comment:
   @mintsweet Nesting level is not related to the fact that Controlled Input 
Components must not have undefined values during its lifecycle. I am going to 
refactor this all later to meet those original principles. This PR has caused 2 
problems:
   
   - Creating `[object]` and `[undefined]` Entries in main **Transformations** 
Map due to use of entityIdKey within an Effect instead of the original handler 
I had implemented.
   - Improper use of controlled input switching from `undefined` to a 
controlled value during its lifecycle.



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