Browse Source

Fix networks not loading properly in Edit Replica

Fixes an issue where sometimes not all environment data was sent to the
API when requesting the list of networks, thus the network might return
an incomplete or incorrect list.
Sergiu Miclea 3 years ago
parent
commit
6e9cc28c27

+ 7 - 4
src/components/modules/TransferModule/TransferItemModal/TransferItemModal.tsx

@@ -480,19 +480,20 @@ class TransferItemModal extends React.Component<Props, State> {
     const stateEnv =
     const stateEnv =
       type === "source" ? this.state.sourceData : this.state.destinationData;
       type === "source" ? this.state.sourceData : this.state.destinationData;
 
 
-    const envData = getFieldChangeOptions({
+    const envData = ObjectUtils.mergeDeep(env, stateEnv);
+    const changedEnvData = getFieldChangeOptions({
       providerName: endpoint.type,
       providerName: endpoint.type,
       schema:
       schema:
         type === "source"
         type === "source"
           ? providerStore.sourceSchema
           ? providerStore.sourceSchema
           : providerStore.destinationSchema,
           : providerStore.destinationSchema,
-      data: ObjectUtils.mergeDeep(env, stateEnv),
+      data: envData,
       field: field || null,
       field: field || null,
       type,
       type,
       parentFieldName,
       parentFieldName,
     });
     });
 
 
-    if (!envData) {
+    if (!changedEnvData) {
       return;
       return;
     }
     }
     providerStore.getOptionsValues({
     providerStore.getOptionsValues({
@@ -879,7 +880,9 @@ class TransferItemModal extends React.Component<Props, State> {
           ...migrationFields.map(f => f.name),
           ...migrationFields.map(f => f.name),
         ]}
         ]}
         dictionaryKey={dictionaryKey}
         dictionaryKey={dictionaryKey}
-        executeNowOptionsDisabled={!providerStore.hasExecuteNowOptions(this.props.sourceEndpoint.type)}
+        executeNowOptionsDisabled={
+          !providerStore.hasExecuteNowOptions(this.props.sourceEndpoint.type)
+        }
       />
       />
     );
     );
   }
   }