fix(icon-grid): Initialize windowWidth to 0

This commit is contained in:
ajnart 2025-04-25 10:05:53 +02:00 committed by Bjorn Lammers
parent f3829f533b
commit 63003a3d6c

View File

@ -21,9 +21,11 @@ export function IconsGrid({ filteredIcons, matchedAliases }: IconsGridProps) {
export function VirtualizedIconsGrid({ filteredIcons, matchedAliases }: IconsGridProps) { export function VirtualizedIconsGrid({ filteredIcons, matchedAliases }: IconsGridProps) {
const listRef = useRef<HTMLDivElement | null>(null) const listRef = useRef<HTMLDivElement | null>(null)
const [windowWidth, setWindowWidth] = useState(typeof window !== "undefined" ? window.innerWidth : 1280) const [windowWidth, setWindowWidth] = useState(0)
useEffect(() => { useEffect(() => {
setWindowWidth(window.innerWidth)
const handleResize = () => { const handleResize = () => {
setWindowWidth(window.innerWidth) setWindowWidth(window.innerWidth)
} }