While a user can pass a url prop to LocationProvider (our types don't support this though), without this location stub, the router will not work during SSR as it unconditionally tries to access location.origin:
I'm generally in favor of pushing the location stub anyhow, it's far more robust in allowing client-side libs to work properly, hence, making it available here for any using the router (but using their own SSR impl). I don't think passing the URL prop to components is a great pattern that we should fix or support really, but that's just me.
While a user can pass a
url
prop toLocationProvider
(our types don't support this though), without this location stub, the router will not work during SSR as it unconditionally tries to accesslocation.origin
:https://github.com/preactjs/preact-iso/blob/2398d3b824af7ff445bf9337082ad9ed523415b5/src/router.js#L72
I'm generally in favor of pushing the
location
stub anyhow, it's far more robust in allowing client-side libs to work properly, hence, making it available here for any using the router (but using their own SSR impl). I don't think passing the URL prop to components is a great pattern that we should fix or support really, but that's just me.