rust-yew-realworld-example-app
rust-yew-realworld-example-app copied to clipboard
GitHub Pages specific way of handling dynamic routes
Describe the bug This is not an app specific issue, but it's just how GitHub Pages handles the URLs. Of course, you may argue that this is not app specific, but it seems easy to solve it.
To Reproduce Steps to reproduce the behavior:
- Go to Home
- Click on Gerome that is the author of the articles.
- This is working as it's handled by the SPA that runs in the browser (and the browser is informed not to do a full reload).
- If you access Gerome link directly (as you may do by hitting F5), then you get the classic 404 page of GitHub Pages.
Expected behavior Of course, expected to get a consistent behavior and see that page again.
Solution There seems to be a pretty standard way of handling this through examples such as this one.
Should I test it and send a PR or you'll do it?
Last but not least, thank you so much for sharing this. :pray: I'm starting to evaluate yew and I saw your comment in one of those production ready issues. That's how I got here.
Basically this will not be an issue in the next release of yew, we can use HashRouter
of yew, see this demo of yew-hooks repo: https://jetli.github.io/yew-hooks/#/use_async, notice the url of this page.
checkout HashRouter
usage here: https://github.com/jetli/yew-hooks/blob/11387ce9a9c8ab27e07b98315309de8c3a55dd7a/examples/yew-app/src/app.rs#L11
for current 0.19 version of yew, I'll investigate the hack of gh pages.
Correct! While the URLs are not that pretty, hash based routing makes such issue disappear.
Upgraded to yew 0.20.0 and use HashRouter