From 19e91024ff035ea513da0b25850ab78712e7b09c Mon Sep 17 00:00:00 2001 From: Darya Plotnytska Date: Tue, 24 Oct 2023 09:53:53 +0200 Subject: [PATCH] console: Use diff patch in full --- .../views/gateway-general-settings/index.js | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/pkg/webui/console/views/gateway-general-settings/index.js b/pkg/webui/console/views/gateway-general-settings/index.js index 278188909f..47e5426945 100644 --- a/pkg/webui/console/views/gateway-general-settings/index.js +++ b/pkg/webui/console/views/gateway-general-settings/index.js @@ -81,24 +81,17 @@ const GatewayGeneralSettingsInner = () => { if (isEqual(gateway.attributes || {}, attributes)) { delete formValues.attributes } - const changed = diff(gateway, formValues) - let update - if ('attributes' in changed) { - update = { - ...changed, - attributes, - } - } else if ('frequency_plan_ids' in changed) { - update = { - ...changed, - frequency_plan_ids, - } - } else { - update = changed + if (isEqual(gateway.frequency_plan_ids || {}, frequency_plan_ids)) { + delete formValues.frequency_plan_ids } + const changed = diff(gateway, formValues, { + patchArraysItems: false, + patchInFull: ['attributes', 'frequency_plan_ids'], + }) + try { - await dispatch(updateGateway(gtwId, update)) + await dispatch(updateGateway(gtwId, changed)) toast({ title: gtwId, message: m.updateSuccess,