prevent render null items in grid

This commit is contained in:
jeffvli
2025-11-01 01:28:33 -07:00
parent 1368c2bd50
commit 5f0309d12b
@@ -404,6 +404,7 @@ const ListComponent = memo((props: ListChildComponentProps<GridItemProps>) => {
} }
for (let i = startIndex; i <= stopIndex + columnCountToAdd; i += 1) { for (let i = startIndex; i <= stopIndex + columnCountToAdd; i += 1) {
if (i < data.length) {
items.push( items.push(
<div <div
className={clsx(styles.itemRow, styles[`gap-${gap}`])} className={clsx(styles.itemRow, styles[`gap-${gap}`])}
@@ -413,6 +414,9 @@ const ListComponent = memo((props: ListChildComponentProps<GridItemProps>) => {
<ItemCard controls={controls} data={data[i]} itemType={itemType} withControls /> <ItemCard controls={controls} data={data[i]} itemType={itemType} withControls />
</div>, </div>,
); );
} else {
items.push(null);
}
} }
return ( return (