Remove code display in notification when useless

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8816
GitOrigin-RevId: bb9fb429670f286579d8cdad7ebcaa41e9c18b28
This commit is contained in:
Nicolas Inchauspe 2023-04-19 16:05:17 +02:00 committed by hasura-bot
parent 4a15cfae99
commit 13a4710083

View File

@ -98,7 +98,7 @@ export const getNotificationDetails = (
detailsJson: Json,
children: React.ReactNode
) => {
return (
return children ? (
<div className="notification-details">
<AceEditor
readOnly
@ -115,7 +115,7 @@ export const getNotificationDetails = (
/>
{children}
</div>
);
) : null;
};
// NOTE: this type has been created by reverse-engineering the original getErrorMessage function
@ -415,7 +415,10 @@ const showWarningNotification = (
): Thunk => {
const children: JSX.Element[] = [];
if (dataObj) {
children.push(getNotificationDetails(dataObj, null));
const notificationDetails = getNotificationDetails(dataObj, null);
if (notificationDetails) {
children.push(notificationDetails);
}
}
if (child) {
children.push(child);