|
@@ -43,6 +43,7 @@ const SendMessage: React.FC<Props> = ({
|
|
}) => {
|
|
}) => {
|
|
const [keyExampleValue, setKeyExampleValue] = React.useState('');
|
|
const [keyExampleValue, setKeyExampleValue] = React.useState('');
|
|
const [contentExampleValue, setContentExampleValue] = React.useState('');
|
|
const [contentExampleValue, setContentExampleValue] = React.useState('');
|
|
|
|
+ const [schemaIsReady, setSchemaIsReady] = React.useState(false);
|
|
const [schemaErrorString, setSchemaErrorString] = React.useState('');
|
|
const [schemaErrorString, setSchemaErrorString] = React.useState('');
|
|
const {
|
|
const {
|
|
register,
|
|
register,
|
|
@@ -62,6 +63,7 @@ const SendMessage: React.FC<Props> = ({
|
|
setKeyExampleValue(
|
|
setKeyExampleValue(
|
|
JSON.stringify(getFakeData(validateKey), null, '\t')
|
|
JSON.stringify(getFakeData(validateKey), null, '\t')
|
|
);
|
|
);
|
|
|
|
+ setSchemaIsReady(true);
|
|
}
|
|
}
|
|
|
|
|
|
const validateContent = convertToYup(
|
|
const validateContent = convertToYup(
|
|
@@ -71,6 +73,11 @@ const SendMessage: React.FC<Props> = ({
|
|
setContentExampleValue(
|
|
setContentExampleValue(
|
|
JSON.stringify(getFakeData(validateContent), null, '\t')
|
|
JSON.stringify(getFakeData(validateContent), null, '\t')
|
|
);
|
|
);
|
|
|
|
+ setSchemaIsReady(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!validateKey && !validateContent) {
|
|
|
|
+ setSchemaIsReady(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, [schemaIsFetched]);
|
|
}, [schemaIsFetched]);
|
|
@@ -109,7 +116,7 @@ const SendMessage: React.FC<Props> = ({
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- if (!keyExampleValue && !contentExampleValue) {
|
|
|
|
|
|
+ if (!schemaIsReady) {
|
|
return <PageLoader />;
|
|
return <PageLoader />;
|
|
}
|
|
}
|
|
return (
|
|
return (
|