From 7e3c66b197894e6f74c87f2e625a4be0dc92bd75 Mon Sep 17 00:00:00 2001 From: NelyDavtyan <96067981+NelyDavtyan@users.noreply.github.com> Date: Wed, 19 Jan 2022 15:41:19 +0400 Subject: [PATCH] fixing empty screen issue when opening edit schema for proto type (#1411) * fixing empty screen issue when opening edit schema for proto type * making requested changes --- kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx b/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx index 63a48580dc..27a109f023 100644 --- a/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx +++ b/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx @@ -37,10 +37,11 @@ const Edit: React.FC = () => { const schema = useAppSelector((state) => selectSchemaById(state, subject)); - const formatedSchema = React.useMemo( - () => JSON.stringify(JSON.parse(schema?.schema || '{}'), null, '\t'), - [schema] - ); + const formatedSchema = React.useMemo(() => { + return schema?.schemaType === SchemaType.PROTOBUF + ? schema?.schema + : JSON.stringify(JSON.parse(schema?.schema || '{}'), null, '\t'); + }, [schema]); const onSubmit = React.useCallback(async (props: NewSchemaSubjectRaw) => { if (!schema) return;