Click here to see the demo
I’m suspending a client component in order to fetch data necessary to render the component, but inside the callback, the window
object is not defined, even though at this stage it should very much have access to it.
Removing window.location.origin
will lead to another error: TypeError: Failed to parse URL from /multipliers.bin
which I believe is because it doesn’t have access to the window object in the first place, much like trying to do new URL('/multipliers.bin')
The library being used to suspend (suspend-react) has nothing to do with the problem, I tested without it by manually throwing a Promise and it still happens, kept it in for better code readability.