Skip to content

Commit

Permalink
chore: docs and logs
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jun 10, 2024
1 parent 880e6d7 commit 87320b7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/router/src/matcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,10 @@ function findInsertionIndex(
if (insertionAncestor) {
upper = matchers.lastIndexOf(insertionAncestor, upper - 1)

if (__DEV__ && upper === -1) {
if (__DEV__ && upper < 0) {
// This should never happen
warn(

Check warning on line 550 in packages/router/src/matcher/index.ts

View check run for this annotation

Codecov / codecov/patch

packages/router/src/matcher/index.ts#L550

Added line #L550 was not covered by tests
`Finding ancestor route ${insertionAncestor.record.path} failed for ${matcher.record.path}`
`Finding ancestor route "${insertionAncestor.record.path}" failed for "${matcher.record.path}"`
)
}
}
Expand All @@ -571,6 +571,13 @@ function getInsertionAncestor(matcher: RouteRecordMatcher) {
return
}

/**
* Checks if a matcher can be reachable. This means if it's possible to reach it as a route. For example, routes without
* a component, or name, or redirect, are just used to group other routes.
* @param matcher
* @param matcher.record record of the matcher
* @returns
*/
function isMatchable({ record }: RouteRecordMatcher): boolean {
return !!(
record.name ||
Expand Down

0 comments on commit 87320b7

Please sign in to comment.