-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Return a 404 when paring the route fails #3860
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!! I wonder if (for spas) we should render just a blank page for 404 routes or perhaps lint that the router doesn't have a 404 route enabled? But definitely the default behavior should be an error.
Just the clippy test (windows might just be failing now) and some docs and it's good to go!
Also - this doesn't completely address throwing a http::ErrorCode::MY_CODE does it?
No, that will be in a follow up PR. It requires more integration with suspense to only send the first chunk down after the suspense boundary the router is in has been resolved |
Maybe in the CLI? Figuring out if we are running in a spa might be difficult. You could nest dioxus-web inside of an axum router that handles the 404 |
* return a 404 when paring the route fails * add a playwright test for fullstack routing status codes * Fix new playwright test * document SSRError * Make SSRError public and fix clippy * Move the error display bound to the routable trait * fix clippy * return a more generic 404 message * fix router tests
* return a 404 when paring the route fails * add a playwright test for fullstack routing status codes * Fix new playwright test * document SSRError * Make SSRError public and fix clippy * Move the error display bound to the routable trait * fix clippy * return a more generic 404 message * fix router tests
This PR changes the router to throw a url parsing error into the context instead of panicing when it fails to parse the current url. On the server, it changes fullstack to return a 404 status if the route is not found or a 500 status if there is another error in the root context
Partially addresses #2739 with better default status codes