Selaa lähdekoodia

Fix updating field to empty value in edit replica

Previously, when editing a replica by completely removing the value from
a field, the empty field was ignored when building the request body with
the updated data.

This is now fixed by using the current state of the replica to determine
whether the updated field value should be sent even if it is empty.
Sergiu Miclea 3 vuotta sitten
vanhempi
sitoutus
84c0c53627
1 muutettua tiedostoa jossa 4 lisäystä ja 5 poistoa
  1. 4 5
      src/plugins/default/OptionsSchemaPlugin.ts

+ 4 - 5
src/plugins/default/OptionsSchemaPlugin.ts

@@ -145,11 +145,10 @@ export const defaultGetDestinationEnv = (
 
 
   Object.keys(options).forEach(optionName => {
   Object.keys(options).forEach(optionName => {
     const value = options[optionName];
     const value = options[optionName];
-    if (
-      specialOptions.find(o => o === optionName) ||
-      value == null ||
-      value === ""
-    ) {
+    const oldValue = oldOptions?.[optionName];
+    const noValue =
+      (value == null || value === "") && (oldValue == null || oldValue === "");
+    if (specialOptions.find(o => o === optionName) || noValue) {
       return;
       return;
     }
     }
     if (Array.isArray(value)) {
     if (Array.isArray(value)) {