-
Notifications
You must be signed in to change notification settings - Fork 256
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
Mounted router fall back to parent router when route is not found #883
base: main
Are you sure you want to change the base?
Conversation
Hides how many mounts are being used
I suggest removing the |
…lows for top router to handle 404s
… where" This reverts commit 387a041.
… last resort in `$serve()`
As written, you can choose to either have 1) 405 and missing-trailing-slash automatically handled for you, or 2) a custom top-level 404 handler, but you cannot have both. |
…ound. In `$serve()`, move `routeNotFoundStep` before `postRouteStep` In `$route()`, if `404` handler has been set, call `lastChanceRouteNotFound()`
Going to wait on this PR for a bit as the changes are fairly drastic compared to current functionality |
A different solution to #881
Situation:
/
;/b/z
is mounted at/a
/c
is mounted at/a/b
Goal: Request
/a/b/c
Current behavior:
/a/b/c
matches against mount location of/
./a/b/c
.New behavior:
/a/b/c
matches against mount location of/
./a/b/c
$route()
is marked asrouteNotFound()
/a/b/c
matches against mount location/a
/b/c
/b/c
does not match any routes$route()
is marked asrouteNotFound()
/a/b/c
matches against mount location/a/b
/c
/c
matches route location/c
/c
is returnedThis would allow for #882 to not be merged, keep the docs as the last mount location. This benefits the user in that their content will always have preference over anything mounted in
/__docs__/
PR task list:
$set_fallback(fallback = TRUE)
?$mount(path, router, fallback = TRUE)
?devtools::document()