fix(striker-ui): don't always show null in FormSummary

main
Tsu-ba-me 2 years ago
parent 1751cef896
commit 446359bfe9
  1. 9
      striker-ui/components/FormSummary.tsx

@ -40,17 +40,20 @@ const buildEntryList = ({
Object.entries(entries).forEach(([itemKey, entry]) => { Object.entries(entries).forEach(([itemKey, entry]) => {
const itemId = `form-summary-entry-${itemKey}`; const itemId = `form-summary-entry-${itemKey}`;
const nest = entry !== null && typeof entry === 'object';
const value = nest ? null : entry;
result.push( result.push(
<MUIListItem <MUIListItem
key={itemId} key={itemId}
sx={{ paddingLeft: `.${depth * 2}em` }} sx={{ paddingLeft: `.${depth * 2}em` }}
{...getListItemProps?.call(null, itemKey, null, depth)} {...getListItemProps?.call(null, itemKey, value, depth)}
> >
{renderEntry(itemKey, null, getEntryLabel, renderEntryValue)} {renderEntry(itemKey, value, getEntryLabel, renderEntryValue)}
</MUIListItem>, </MUIListItem>,
); );
if (entry !== null && typeof entry === 'object' && depth < maxDepth) { if (nest && depth < maxDepth) {
result.push( result.push(
buildEntryList({ buildEntryList({
depth: depth + 1, depth: depth + 1,

Loading…
Cancel
Save