diff --git a/src/apps/related-materials/related-materials.entry.jsx b/src/apps/related-materials/related-materials.entry.jsx index dbd5a02a..7065e4cf 100644 --- a/src/apps/related-materials/related-materials.entry.jsx +++ b/src/apps/related-materials/related-materials.entry.jsx @@ -138,9 +138,11 @@ function useGetRelatedMaterials({ const finishedMaterials = related?.filter(material => material.data)?.length || 0; const tries = relatedMaterials.tries + 1; + // If we have no materials to show then finish using the empty state. + const endStatus = finishedMaterials > 0 ? "finished" : "empty"; const status = finishedMaterials >= amount || tries >= maxTries - ? "finished" + ? endStatus : "processing"; setRelatedMaterials({ status, diff --git a/src/apps/related-materials/related-materials.jsx b/src/apps/related-materials/related-materials.jsx index ebdf313c..f6e39a46 100644 --- a/src/apps/related-materials/related-materials.jsx +++ b/src/apps/related-materials/related-materials.jsx @@ -80,10 +80,13 @@ function RelatedMaterials({ searchText, titleText }) { - if (status === "failed") { - // We fail discretly since there is no use in showing links or anything since the fail - // would mean a lack of works/materials. + if (status === "failed" || status === "empty") { + // Return discretly. + // When a failure occurs there is no use in showing links or anything since + // the fail would mean a lack of works/materials. // An actual unhandled failure would still result in our error boundary. + // At the moment we also do not render anything if there are no materials + // to show. return null; } return (