v1ack / svelte-virtual-scroll-list

Virtualized scrolling for big lists
https://v1ack.github.io/svelte-virtual-scroll-list/
MIT License
114 stars 18 forks source link

Adds checks against SSR for when pageMode is enabled #7

Closed ghost closed 1 year ago

ghost commented 2 years ago

Hello! During SSR, we're getting the following error:

ReferenceError: Server-side code is attempting to access the global variable "window", which is client only. See https://sapper.svelte.dev/docs/#Server-side_rendering

We were able to fix it by adding some checks against the window object for when pageMode=true in the VirtualScroll.svelte file. Is this something we could have added to the project?

if (pageMode && !(typeof window === 'undefined')) {

v1ack commented 1 year ago

Thanks, done