From 150c0766e057b9e80f08025f0b9556c81d9b3298 Mon Sep 17 00:00:00 2001 From: Benjamin Schmidt Date: Thu, 7 Nov 2024 16:12:26 -0500 Subject: [PATCH] fix: throw errors when full urls are passed (#20) --- src/lib/Folio.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/Folio.tsx b/src/lib/Folio.tsx index 1e83ba1..374c924 100644 --- a/src/lib/Folio.tsx +++ b/src/lib/Folio.tsx @@ -37,6 +37,14 @@ const Folio = ({ children, hash, zoom, duration }: FolioProps) => { const containerRef = useRef(null); const { activeDiv, iframe, observer, folioMap, atlasURL } = useObserver(); + if (hash?.includes('https')) { + throw new Error( + `Please pass only the hash, not the full URL -- did you mean to pass ${ + hash.split('#')[1] + } instead of ${hash}?` + ); + } + useEffect(() => { if (containerRef.current && folioMap) { folioMap.set(containerRef.current, { hash, zoom, duration });