CM: Display review stage in empty state instead of crashing the app

This commit is contained in:
Gustav Hansen 2023-04-12 09:54:57 +02:00
parent 23abbc63d8
commit fd75b0bb0f

View File

@ -1,6 +1,7 @@
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import { Typography } from '@strapi/design-system';
import { DynamicTable as Table, useStrapiApp } from '@strapi/helper-plugin';
import { useSelector } from 'react-redux';
@ -90,6 +91,12 @@ const DynamicTable = ({
sortable: false,
},
cellFormatter({ strapi_reviewWorkflows_stage }) {
// if entities are created e.g. through lifecycle methods
// they may not have a stage assigned
if (!strapi_reviewWorkflows_stage) {
return <Typography textColor="neutral800">-</Typography>;
}
return <ReviewWorkflowsStage name={strapi_reviewWorkflows_stage.name} />;
},
});