From a0c98951226d6b89b1fe16527d674f50d7afeb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 21 Jan 2024 21:06:12 -0600 Subject: [PATCH] fix: window undefined check --- src/app/tools/tankopedia/components/TankSearch/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/tools/tankopedia/components/TankSearch/index.tsx b/src/app/tools/tankopedia/components/TankSearch/index.tsx index 655b8e33a..b4c091ca0 100644 --- a/src/app/tools/tankopedia/components/TankSearch/index.tsx +++ b/src/app/tools/tankopedia/components/TankSearch/index.tsx @@ -82,7 +82,10 @@ export function TankSearch({ compact, onSelect = () => {} }: TankSearchProps) { ); const [searchResults, setSearchedList] = useState(searchableTanks); const page = useTankopediaPersistent((state) => state.filters.page); - const chunkSize = window.innerWidth > 512 ? tanksPerPage / 2 : Infinity; + const chunkSize = + typeof window !== 'undefined' && window.innerWidth > 512 + ? tanksPerPage / 2 + : Infinity; const searchResultsPageSlice = searchResults.slice( page * tanksPerPage, (page + 1) * tanksPerPage,