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

feat: Add location stub utility #28

Merged
merged 3 commits into from
Jul 8, 2024
Merged

Conversation

rschristian
Copy link
Member

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:

const u = new URL(url, 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.

src/prerender.js Outdated Show resolved Hide resolved
@rschristian rschristian force-pushed the feat/location-patcherr branch 2 times, most recently from 4f69f96 to 29c7d6f Compare July 7, 2024 23:51
@rschristian rschristian merged commit 1337db0 into main Jul 8, 2024
1 check passed
@rschristian rschristian deleted the feat/location-patcherr branch July 8, 2024 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant