diff --git a/.changeset/itchy-adults-cheer.md b/.changeset/itchy-adults-cheer.md new file mode 100644 index 00000000..7529ea01 --- /dev/null +++ b/.changeset/itchy-adults-cheer.md @@ -0,0 +1,5 @@ +--- +'@reuters-graphics/graphics-components': patch +--- + +Don't fetch referrals on non-dotcom domains diff --git a/src/components/ReferralBlock/ReferralBlock.svelte b/src/components/ReferralBlock/ReferralBlock.svelte index bdf825c7..a3c959ed 100644 --- a/src/components/ReferralBlock/ReferralBlock.svelte +++ b/src/components/ReferralBlock/ReferralBlock.svelte @@ -67,6 +67,9 @@ let referrals: Article[] = $state([]); const getReferrals = async () => { + if (typeof window === 'undefined') return; + // fetch only reliably works on prod sites + if (window?.location?.hostname !== 'www.reuters.com') return; const isCollection = Boolean(collection); const API = isCollection ? COLLECTION_API : SECTION_API; try {