diff --git a/static-site/src/components/ListResources/IndividualResource.tsx b/static-site/src/components/ListResources/IndividualResource.tsx index c33ea6072..c14c79a63 100644 --- a/static-site/src/components/ListResources/IndividualResource.tsx +++ b/static-site/src/components/ListResources/IndividualResource.tsx @@ -126,10 +126,11 @@ export const IndividualResource = ({resource, isMobile}: IndividualResourceProps const ref = useRef(null); const [topOfColumn, setTopOfColumn] = useState(false); useEffect(() => { - // don't do anything if the ref is undefined or the parent is not a div (IndividualResourceContainer) - if (!ref.current - || !ref.current.parentNode - || ref.current.parentNode.nodeName != 'DIV') return; + if (ref.current === null || + ref.current.parentNode === null || + ref.current.parentNode.nodeName != 'DIV') { + throw new InternalError("ref must be defined and the parent must be a div (IndividualResourceContainer)."); + } /* The column CSS is great but doesn't allow us to know if an element is at the top of its column, so we resort to JS */