Skip to content

Commit

Permalink
console: Remove previous selection when changing wifi enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelJankoski committed Sep 20, 2024
1 parent 65e0d22 commit ca059f8
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ const WifiSettingsFormFields = ({ initialValues, isWifiConnected, saveFormClicke
[setValues],
)

const handleEnableWifiChange = useCallback(() => {
const { _profile_of, ...initialProfile } = initialWifiProfile
setValues(oldValues => ({
...oldValues,
wifi_profile: {
...oldValues.wifi_profile,
...initialProfile,
},
}))
}, [setValues])

return (
<>
<Message component="h3" content={m.wifiConnection} className="mt-0" />
Expand All @@ -221,6 +232,7 @@ const WifiSettingsFormFields = ({ initialValues, isWifiConnected, saveFormClicke
name={`wifi_profile._enable_wifi_connection`}
component={Checkbox}
label={m.enableWifiConnection}
onChange={handleEnableWifiChange}
/>
{values.wifi_profile._enable_wifi_connection && (
<>
Expand Down

0 comments on commit ca059f8

Please sign in to comment.