Skip to content

Commit

Permalink
Merge pull request #6651 from TheThingsNetwork/fix/frequency-plan-set…
Browse files Browse the repository at this point in the history
…tings

Fix frequency plans getting unset if any of the frequency plans is removed
  • Loading branch information
ryaplots authored Oct 25, 2023
2 parents e1b0bc2 + 19e9102 commit c3af4d5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/webui/console/views/gateway-general-settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,21 @@ const GatewayGeneralSettingsInner = () => {
const handleSubmit = useCallback(
async values => {
const formValues = { ...values }
const { attributes } = formValues
const { attributes, frequency_plan_ids } = formValues
if (isEqual(gateway.attributes || {}, attributes)) {
delete formValues.attributes
}
const changed = diff(gateway, formValues)
const update = 'attributes' in changed ? { ...changed, attributes } : 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 c3af4d5

Please sign in to comment.