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

React - Fix missing server url params & query #11

Merged
merged 5 commits into from
Apr 3, 2021

Conversation

huygn
Copy link
Contributor

@huygn huygn commented Apr 2, 2021

react/utils

Currently there is no route params received on props handler function, those matched params can be found in the match property of matchRoutes.

react/entry-client

Prior to this it was sending route's path to fetch method .eg you'll see /post/:postId on the network tab instead of /post/1 and thus causing a wrong props fetch, this tries to fix that behavior by using window.location's pathname & search query.

example/react

updated the example for the sake of demonstration (/post/:postId) path.

Copy link
Owner

@frandiox frandiox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huygn Thank you for taking the time to fix this!
Looks like there's still an issue with the parameters. It works on first rendering (SSR) but doesn't work when changing routes afterwards (in SPA take-over).

I've released a new version of vite-ssr addressing this problem (code here) and now the to route should contain the correct path, params, etc. I'm going to merge this and fix it in master branch 👍

@frandiox frandiox merged commit 8069bb1 into frandiox:master Apr 3, 2021
@frandiox
Copy link
Owner

frandiox commented Apr 3, 2021

@huygn Released in 0.10.2 🎉

@huygn huygn deleted the fix/react-url-params branch April 5, 2021 11:05
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.

2 participants