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


##########
config-ui/src/components/blueprints/transformations/CICD/Deployment.jsx:
##########
@@ -15,76 +15,45 @@
  * limitations under the License.
  *
  */
-import React, { useState, useEffect, useMemo, useCallback } from 'react'
+import React, { useState, useEffect } from 'react'
 import {
   Intent,
   FormGroup,
   RadioGroup,
   InputGroup,
   Radio,
-  Tag,
-  Icon,
-  Colors,
-  Tooltip
+  Tag
 } from '@blueprintjs/core'
 import { Providers, ProviderLabels } from '@/data/Providers'
+
 const Deployment = (props) => {
   const {
-    connection,
     provider,
     transformation,
-    configuredProject,
-    configuredBoard,
     entityIdKey,
-    entities = [],
     isSaving = false,
     onSettingsChange = () => {}
   } = props
 
-  const [deployTag, setDeployTag] = useState(
-    transformation?.productionPattern || ''
-  )
-  const [enableDeployTag, setEnableDeployTag] = useState(
-    [
-      transformation?.productionPattern
-      // transformation?.stagingPattern,
-      // transformation?.testingPattern
-    ].some((t) => t && t !== '')
-      ? 1
-      : 0
-  )
-  const isDeployTagEmpty = useMemo(
-    () =>
-      enableDeployTag &&
-      (transformation?.productionPattern === '' ||
-        !transformation?.productionPattern),
-    [enableDeployTag, transformation?.productionPattern]
-  )
+  const [selectValue, setSelectValue] = useState(1)
 
-  const clearDeploymentTags = useCallback(
-    (deploymentOption) => {
-      if (entityIdKey && deploymentOption === 0) {
-        onSettingsChange({ productionPattern: '' }, entityIdKey)
-        // onSettingsChange({ stagingPattern: '' }, entityIdKey)
-        // onSettingsChange({ testingPattern: '' }, entityIdKey)
-      }
-    },
-    [entityIdKey, onSettingsChange]
-  )
+  useEffect(() => {
+    setSelectValue(
+      transformation?.deploymentPattern ||
+        transformation?.deploymentPattern === ''
+        ? 1
+        : 0
+    )
+  }, [transformation?.deploymentPattern])
 
-  const handleDeploymentPreference = useCallback(

Review Comment:
   @mintsweet This handler should not have been refactored, with these changes 
you are now introducing `undefined` and `[object]` entries into the main 
Transformations stack.
   
   <img width="1223" alt="Screen Shot 2022-09-22 at 9 40 03 AM" 
src="https://user-images.githubusercontent.com/1742233/191762885-4c261760-816a-4250-a0b9-29aac2b54406.png";>
   
   



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