diff --git a/services/madoc-ts/src/frontend/site/features/TopicGrid.tsx b/services/madoc-ts/src/frontend/site/features/TopicGrid.tsx index 2f29d6634..51d07e95f 100644 --- a/services/madoc-ts/src/frontend/site/features/TopicGrid.tsx +++ b/services/madoc-ts/src/frontend/site/features/TopicGrid.tsx @@ -27,11 +27,13 @@ export const TopicGrid: React.FC<{ cardBorder?: string; imageStyle?: string; }> = ({ background, textColor, cardBorder }) => { - const scrollX = window.scrollX; - const scrollY = window.scrollY; - useLayoutEffect(() => { - window.scrollTo(scrollX, scrollY); + if (typeof window !== 'undefined') { + const scrollX = window.scrollX; + const scrollY = window.scrollY; + + window.scrollTo(scrollX, scrollY); + } }); const { data } = useTopicType();