Skip to content

Commit

Permalink
Fix repeat item not rendering properly without a parent item
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed Sep 9, 2024
1 parent af3fb8b commit 19a4a13
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ import useHidden from '../../hooks/useHidden';
import GroupItemSwitcher from '../FormComponents/GroupItem/GroupItemSwitcher';
import useReadOnly from '../../hooks/useReadOnly';
import Box from '@mui/material/Box';
import { isSpecificItemControl } from '../../utils';
import { isRepeatItemAndNotCheckbox, isSpecificItemControl } from '../../utils';
import GroupTable from '../FormComponents/Tables/GroupTable';
import RepeatItem from '../FormComponents/RepeatItem/RepeatItem';

interface FormTopLevelItemProps
extends PropsWithQrItemChangeHandler,
Expand Down Expand Up @@ -156,6 +157,20 @@ function FormTopLevelItem(props: FormTopLevelItemProps) {
}

// Otherwise, it is rendered as a non-group item
const itemRepeatsAndIsNotCheckbox = isRepeatItemAndNotCheckbox(topLevelQItem);
if (itemRepeatsAndIsNotCheckbox) {
return (
<RepeatItem
key={topLevelQItem.linkId}
qItem={topLevelQItem}
qrItem={topLevelQRItem}
groupCardElevation={1}
parentIsReadOnly={readOnly}
onQrItemChange={onQrItemChange}
/>
);
}

return (
<Box mt={1}>
<SingleItem
Expand Down

0 comments on commit 19a4a13

Please sign in to comment.