Skip to content

Commit

Permalink
Handle possible array of promo snippets
Browse files Browse the repository at this point in the history
Although we should NOT have them, and only the first will display
  • Loading branch information
RoyEJohnson committed Feb 6, 2024
1 parent a65c3b8 commit 2a685a3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/pages/details/desktop-view/details-tab/details-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function PolishTab({model}) {
}

function Promo({data}) {
if (!data) {
if (!data?.content) {
return null;
}

Expand All @@ -43,6 +43,10 @@ function Promo({data}) {
}

function EnglishTab({model}) {
// promoteSnippet may or may not be in an array
const obj = model.promoteSnippet;
const promoData = obj.length ? obj[0] : obj;

return (
<div className="details-tab">
<div className="sidebar">
Expand All @@ -57,7 +61,7 @@ function EnglishTab({model}) {
</div>
</div>
<div className="main">
<Promo data={model.promoteSnippet[0]} />
<Promo data={promoData} />
<div className="loc-summary-text">
<h3>
<FormattedMessage id="summary" defaultMessage="Summary" />
Expand Down

0 comments on commit 2a685a3

Please sign in to comment.