-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
1 addition
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -790,7 +790,7 @@ function flattenRoutes( | |
let path: string; | ||
if (route.path.startsWith("/")) { | ||
invariant( | ||
parentPath && !route.path.startsWith(parentPath), | ||
!(parentPath && !route.path.startsWith(parentPath)), | ||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
mjackson
Member
|
||
`Absolute <Route path="${route.path}"> must begin ` + | ||
`with its parent path "${parentPath}", otherwise it ` + | ||
`will be unreachable.` | ||
|
Thanks for catching this. Boolean logic was never my forte 😅
FWIW I think the cleanest way to express this is probably:
It uses one less
!
and reads more like you'd say it out loud: "make sure there is either no parent path or the route path starts with the parent path".