Skip to content

Commit

Permalink
early return if we dont have cards to display (#12722)
Browse files Browse the repository at this point in the history
  • Loading branch information
abeddow91 authored Oct 30, 2024
1 parent 1e0d19e commit cfef984
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dotcom-rendering/src/components/FlexibleGeneral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ export const StandardCardLayout = ({
absoluteServerTimes: boolean;
showImage?: boolean;
}) => {
if (cards.length === 0) return null;

return (
<UL
direction="row"
Expand Down
3 changes: 1 addition & 2 deletions dotcom-rendering/src/components/FlexibleSpecial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ const TwoCardOrFourCardLayout = ({
absoluteServerTimes: boolean;
showImage?: boolean;
}) => {
if (cards.length === 0) return null;
const hasTwoOrFewerCards = cards.length <= 2;
return (
<UL
Expand Down Expand Up @@ -242,15 +243,13 @@ export const FlexibleSpecial = ({
absoluteServerTimes={absoluteServerTimes}
imageLoading={imageLoading}
/>

<OneCardLayout
cards={splash}
containerPalette={containerPalette}
showAge={showAge}
absoluteServerTimes={absoluteServerTimes}
imageLoading={imageLoading}
/>

<TwoCardOrFourCardLayout
cards={cards}
containerPalette={containerPalette}
Expand Down

0 comments on commit cfef984

Please sign in to comment.