Skip to content

Commit

Permalink
Merge pull request #3609 from owid/research-and-writing-component-err…
Browse files Browse the repository at this point in the history
…or-rendering

🐛 fix research-and-writing links still rendering on bake even when content is invalid
  • Loading branch information
ikesau authored May 17, 2024
2 parents 1263993 + 80c9e3e commit 359a612
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions site/gdocs/components/ResearchAndWriting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ function ResearchAndWritingLink(
const { linkedDocument, errorMessage } = useLinkedDocument(url)
const { isPreviewing } = useContext(DocumentContext)

if (isPreviewing && errorMessage) {
return (
<div className={cx(className, "research-and-writing-link--error")}>
<p>{errorMessage}</p>
<p>This block won't render during baking</p>
</div>
)
if (errorMessage) {
if (isPreviewing) {
return (
<div
className={cx(
className,
"research-and-writing-link--error"
)}
>
<p>{errorMessage}</p>
<p>This block won't render during baking</p>
</div>
)
}
return null
}

if (linkedDocument) {
Expand Down

0 comments on commit 359a612

Please sign in to comment.