Skip to content

Commit

Permalink
console: Fix pubsub form
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelJankoski committed Nov 22, 2023
1 parent c3c853b commit 2f84769
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/webui/console/components/pubsub-form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const PubsubForm = props => {
existCheck,
onDelete,
} = props
const [initialValues, setInitialValues] = useState(blankValues)
const [error, setError] = useState(undefined)
const [provider, setProvider] = useState(blankValues._provider)
const [mqttSecure, setMqttSecure] = useState(true)
Expand All @@ -71,11 +70,15 @@ const PubsubForm = props => {
const [displayOverwriteModal, setDisplayOverwriteModal] = useState(false)
const [existingId, setExistingId] = useState(undefined)

useEffect(() => {
const initialValues = useMemo(() => {
if (update && initialPubsubValue) {
setInitialValues(mapPubsubToFormValues(initialPubsubValue))
return mapPubsubToFormValues(initialPubsubValue)
}
return {
...blankValues,
_provider: provider,
}
}, [initialPubsubValue, update])
}, [initialPubsubValue, provider, update])

useEffect(() => {
if (natsDisabled && mqttDisabled) {
Expand Down

0 comments on commit 2f84769

Please sign in to comment.