diff --git a/pexels-grid/src/components/GalleryController.tsx b/pexels-grid/src/components/GalleryController.tsx index 94ca5ce..34739c4 100644 --- a/pexels-grid/src/components/GalleryController.tsx +++ b/pexels-grid/src/components/GalleryController.tsx @@ -7,8 +7,11 @@ import { useQuery } from "@tanstack/react-query"; import { useSearchParams, useRouter } from "next/navigation"; import { Photo, Video } from "pexels"; import { useEffect } from "react"; -const getVisibleBuffer = () => (window.innerWidth > 700 ? 7000 : 3000); +const getVisibleBuffer = () => (typeof window !== undefined ? window.innerWidth > 700 ? 7000 : 3000 : 3000); const getColumnWidth = () => { + if(typeof window === undefined) { + return 640 + } let columnWidth = window.innerWidth < 1536 ? window.innerWidth * 0.33 : window.innerWidth / 4; if (window.innerWidth < 1280) columnWidth = window.innerWidth / 2;