Skip to content

Commit 223fc4d

Browse files
committed
fix schema registry config
1 parent 359069b commit 223fc4d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

frontend/src/widgets/ClusterConfigForm/Sections/SchemaRegistry.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
import React from 'react';
2+
import { useState } from 'react';
23
import Input from 'components/common/Input/Input';
34
import { useFormContext } from 'react-hook-form';
45
import SectionHeader from 'widgets/ClusterConfigForm/common/SectionHeader';
56
import SSLForm from 'widgets/ClusterConfigForm/common/SSLForm';
67
import Credentials from 'widgets/ClusterConfigForm/common/Credentials';
78

89
const SchemaRegistry = () => {
9-
const { setValue, watch } = useFormContext();
10-
const schemaRegistry = watch('schemaRegistry');
10+
const { setValue } = useFormContext();
11+
const [configOpen, setConfigOpen] = useState(false);
1112
const toggleConfig = () => {
12-
setValue(
13-
'schemaRegistry',
14-
schemaRegistry ? undefined : { url: '', isAuth: false },
15-
{ shouldValidate: true, shouldDirty: true, shouldTouch: true }
16-
);
13+
setConfigOpen((prevConfigOpen) => !prevConfigOpen);
14+
setValue('schemaRegistry', { url: '', isAuth: false });
1715
};
1816
return (
1917
<>
2018
<SectionHeader
2119
title="Schema Registry"
22-
adding={!schemaRegistry}
20+
adding={!configOpen}
2321
addButtonText="Configure Schema Registry"
2422
onClick={toggleConfig}
2523
/>
26-
{schemaRegistry && (
24+
{configOpen && (
2725
<>
2826
<Input
2927
label="URL *"

0 commit comments

Comments
 (0)