solid-primitives icon indicating copy to clipboard operation
solid-primitives copied to clipboard

Running in a worker throws Uncaught ReferenceError: window is not defined

Open cherealnice opened this issue 2 years ago • 0 comments

Describe the bug

I am trying to run captureStoreUpdates in another thread, and I'm getting Uncaught ReferenceError: window is not defined. This seems to be due to the scheduleIdle fn trying to call window.requestIdleCallback. I'm suggesting a change where we check typeof window and fallback to throttle in the case that it doesn't exist, like what is done for when requestIdleCallback is not defined

Minimal Reproduction Link

https://stackblitz.com/edit/github-vu8q2i?file=src%2Fworker.ts

cherealnice avatar Oct 27 '24 09:10 cherealnice