Feroze Mohideen 2 лет назад
Родитель
Сommit
0af525e45b

+ 16 - 14
dashboard/src/main/home/app-dashboard/validate-apply/services-settings/tabs/IngressCustomAnnotations.tsx

@@ -52,20 +52,22 @@ const IngressCustomAnnotations: React.FC<Props> = ({ index }) => {
                         // Otherwise, the backend will merge the old set of keys with the new set, and the original key
                         // will still exist.
                         onChange: (e) => {
-                          if (
-                            e.target.value &&
-                            e.target.value !== annotation.key
-                          ) {
-                            setValue(
-                              `app.services.${index}.config.ingressAnnotations.${i}.key`,
-                              e.target.value
-                            );
-                            if (
-                              !fieldsAnnotationDeletion.find(
-                                (d) => d.key === annotation.key
-                              )
-                            ) {
-                              appendAnnotationDeletion({ key: annotation.key });
+                          if (e.target.value) {
+                            const newValue = e.target.value.trim();
+                            if (newValue !== annotation.key) {
+                              setValue(
+                                `app.services.${index}.config.ingressAnnotations.${i}.key`,
+                                newValue
+                              );
+                              if (
+                                !fieldsAnnotationDeletion.find(
+                                  (d) => d.key === annotation.key
+                                )
+                              ) {
+                                appendAnnotationDeletion({
+                                  key: annotation.key,
+                                });
+                              }
                             }
                           }
                         },