fix(createVirtualizer): add window check to resolve the ReferenceError
Workflow / publish (push) Has been cancelled
Workflow / build (push) Has been cancelled

This commit is contained in:
Ilia Mashkov
2026-04-22 13:37:23 +03:00
parent 47a8487ce9
commit f97afc2425
@@ -258,12 +258,13 @@ export function createVirtualizer<T>(
// Calculate initial offset ONCE // Calculate initial offset ONCE
const getElementOffset = () => { const getElementOffset = () => {
const rect = node.getBoundingClientRect(); const rect = node.getBoundingClientRect();
return rect.top + window.scrollY; const scrollY = typeof window !== 'undefined' ? window.scrollY : 0;
return rect.top + scrollY;
}; };
let cachedOffsetTop = 0; let cachedOffsetTop = 0;
let rafId: number | null = null; let rafId: number | null = null;
containerHeight = window.innerHeight; containerHeight = typeof window !== 'undefined' ? window.innerHeight : 0;
const handleScroll = () => { const handleScroll = () => {
if (rafId !== null) { if (rafId !== null) {