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
This commit is contained in:
NelyDavtyan 2022-01-19 15:41:19 +04:00 committed by GitHub
parent 1231ee6314
commit 7e3c66b197
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;