Skip to content

Commit

Permalink
fix: throw errors when full urls are passed (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmschmidt authored Nov 7, 2024
1 parent 958424c commit 150c076
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/Folio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ const Folio = ({ children, hash, zoom, duration }: FolioProps) => {
const containerRef = useRef<HTMLDivElement>(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 });
Expand Down

0 comments on commit 150c076

Please sign in to comment.