Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change window to globalThis in Virtualizer.ts for SSR #4564

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rare-actors-grab.md
@@ -0,0 +1,5 @@
---
'@lit-labs/virtualizer': major
---

Change window to globalThis in Virtualizer.ts to support SSR scenarios.
IMinchev64 marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 2 additions & 1 deletion packages/labs/virtualizer/src/Virtualizer.ts
Expand Up @@ -34,7 +34,8 @@ import {ScrollerController} from './ScrollerController.js';
// polyfill in the package; this bit of module state facilitates
// a simple mechanism (see ./polyfillLoaders/ResizeObserver.js.)
// for loading the polyfill.
let _ResizeObserver: typeof ResizeObserver | undefined = window?.ResizeObserver;
let _ResizeObserver: typeof ResizeObserver | undefined =
globalThis?.ResizeObserver;
IMinchev64 marked this conversation as resolved.
Show resolved Hide resolved

/**
* Call this function to provide a `ResizeObserver` polyfill for Virtualizer to use.
Expand Down