Browse Source

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
NelyDavtyan 3 years ago
parent
commit
7e3c66b197
1 changed files with 5 additions and 4 deletions
  1. 5 4
      kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx

+ 5 - 4
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;