mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-06-28 15:30:22 +08:00
fix(icon-grid): Initialize windowWidth to 0
This commit is contained in:
parent
f3829f533b
commit
63003a3d6c
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user