-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
add <NotFoundRoute/>
#140
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
Comments
In the discussion in #142 it is apparent that @rpflorence wants a way to nest his Instead, let's extend the matching behavior of The change will be to allow a |
Route
with no children and no name/path match
Renamed as solution discussed in #142 |
Route
with no children and no name/path match<NotFoundRoute/>
|
+1 |
Ideally I would like to see more than one
|
@mtscout6 Nested |
+1 |
@mtscout6 <Routes>
<Route handler={Docs}>
...
<Route path="docs*" handler={DocNotFound} />
</Route>
<Route handler={App}>
...
<Route path="*" handler={AppNotFound} />
</Route>
</Routes> Maybe there's a case to add path matching to |
What I was primarily trying to get at, and maybe this is part of a separate issue in that being explicit with the url all the time is getting exhausting. Take for example what I've got going in a portion of our app so far: (This is just and small piece of a larger app, and we will be adding at least 30+ more routes under the <Route path='/customers/:customerId' handler={CustomerRecord}>
<Route name='customer' path='/customers/:customerId' handler={CustomerRecordRedirect} />
<Route name='familyMember' path='/customers/:customerId/family-member/:familyMember' handler={FamilyMemberRecord} />
<Route name='quoting' path='/customers/:customerId/quoting' handler={CustomerQuoting} />
<Route name='cart' path='/customers/:customerId/cart' handler={CustomerCart} />
<Route name='applicationsAndPolicies' path='/customers/:customerId/applications-and-policies' handler={TasksAndAppointments} />
<Route name='tasksAndAppointments' path='/customers/:customerId/tasks-and-appointments' handler={TasksAndAppointments} />
</Route> In this example the root's path of So, I've found the customer it does exist, but the rest of the url does not, then I don't want to redirect them to an application 404. So, I was envisioning sub application 404s. |
We've talked about having CUSTOMER+'/family-member/:familyMember'`
CUSTOMER+'/quoting' |
I feel that that is an intermediary step, because now you have replaced CUSTOMER = '/customers/:customerId';
CART = CUSTOMER + '/cart';
...
<Route name='cart-confirm' path={CART+'/confirmation'} /> Which is requiring a large amount of constants defined at the top when absolute vs relative support would do the same thing. Although that feels like a concern to address in #142. What I'm getting at on this issue is that support for a |
can you provide some example urls "after |
/customer/:customerId/the-user-typed-something-in-the-url-bar |
^ works today |
I know that would do, I'll drop it. |
Although, if you do the absolute vs relative path, now I'd have to use an absolute path in a sea of relative paths usage, assuming you adopt that approach. |
its a valid use-case I want to support because we support it today. We need more powerful path matching and that might mean changing the meaning of |
The requirements here have changed because of the work done in #200. Once we merge that, any From this point forward, my suggestion for
The key difference is that <Routes>
<!-- Matches /* after trying all other siblings -->
<NotFoundRoute handler={NotFound}/>
<!-- Matches / (purely UI) -->
<Route handler={App}>
<Route name="user" path="/users/:id" handler={User}>
<!-- Matches /users/5 -->
<DefaultRoute handler={Dashboard}/>
<!-- Matches /users/5/* after trying all other siblings -->
<NotFoundRoute handler={UserNotFound}/>
<!-- Matches /users/5/news -->
<Route path="/users/:id/news" handler={News}/>
</Route>
</Route>
</Routes> |
yes, this is exactly how I imagined it working when we had both |
Ah, here it is, the doozy of a post: #142 (comment) |
Seriously. Trying to keep them all straight in my head :) Would definitely help if we try and keep the scope of each one as small as possible and open new issues for tangents. |
I collected the path stuff a while ago into a milestone, btw |
I'm gonna try and get #142 resolved before this. Feels like this one depends on that. |
In #112 we discussed adding a defaultHandler prop to Routes that would be responsible for handling situations where no routes in the tree match. Let's follow up on that work here.
The text was updated successfully, but these errors were encountered: