- Notifications
You must be signed in to change notification settings - Fork167
Open
Description
Fallback not found route is a little bit confused withnest
.
Example
<Switch><Routepath="/"nest><AppPage><Routepath="/posts"><PostsView/></Route><Routepath="/posts/:postId"><PostDetailView/></Route></AppPage></Route><Routepath="/auth"><AuthPage/></Route><Route><NotFound/></Route></Switch>
- '/' represents app page,
<AppPage/>
wraps nested views. - '/auth' represents unauthorized page,
<AuthPage/>
contains login form. - The last route fallback to a not found page (globally)
Unexpected
- '/some-path-not-exist' didn't reach the not found page route
- The nest '/' route caught every non-existing paths instead, even the path is not existing inside nesting.
Expected
- Whether
nest
prop true of false, should maintain the same expectations - '/some-path-not-exist' path should match the fallback route -
<NotFound />
if it's not being strictly matched inside nesting routes.
Suggestions
For example
<Switch><Routepath="/"nest><Routepath="settings"nest><SettingsView><Switch><Routepath="appearance"><AppearanceView/></Route><Route>Not found - You may checkout /settings/appearance</Route></Switch></SettingsView></Route></Route><Route><NotFound/></Route></Switch>;
Would be better:
- Match inside not found if '/settings/some-path-not-exist'
- Match outside not found if '/some-path-not-exist'
- '/settings/language' fallbacks to inside not found (
<Route>Not found - You may checkout /settings/appearance</Route>
) - '/set' fallbacks to outside
Metadata
Metadata
Assignees
Labels
No labels