Skip to content

Commit

Permalink
console: Use diff patch in full
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaplots committed Oct 24, 2023
1 parent c37d3a9 commit 19e9102
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions pkg/webui/console/views/gateway-general-settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 19e9102

Please sign in to comment.