Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1011 from B77Mills/converterBug
Browse files Browse the repository at this point in the history
Ensure prop !null before getting node or setting fallback
  • Loading branch information
B77Mills authored Nov 12, 2024
2 parents c3f0773 + e55d4d4 commit bad7fa1
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ module.exports = ({ advertisingPost, preview }) => {
const { label } = statusEdge && statusEdge.node ? statusEdge.node : {};
const isPublished = label === 'Published' && (new Date() >= new Date(publishedDay));
if (id && (isPublished || preview)) {
const { _id: imageId, src } = featuredImageEdge.node || { src: { settings: {} } };
const { _id: imageId, src } = (featuredImageEdge && featuredImageEdge.node)
? featuredImageEdge.node
: { src: { settings: {} } };
const primaryImage = {
id: imageId,
src: src.url,
Expand All @@ -20,8 +22,12 @@ module.exports = ({ advertisingPost, preview }) => {
y: src.settings.fpY,
},
};
const { _id: companyId, name, logoEdge } = companyEdge.node || { logoEdge: {} };
const { _id: logoId, src: logoSrc } = logoEdge.node || { src: { settings: {} } };
const { _id: companyId, name, logoEdge } = (companyEdge && companyEdge.node)
? companyEdge.node
: { logoEdge: {} };
const { _id: logoId, src: logoSrc } = (logoEdge && logoEdge.node)
? logoEdge.node
: { src: { settings: {} } };
const advertiser = {
id: companyId,
name,
Expand Down

0 comments on commit bad7fa1

Please sign in to comment.