Skip to content

Commit

Permalink
feat: add matchLast option to RouteConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Aug 24, 2023
1 parent a0fa434 commit df7422e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runtime/routeHooks.ts
Expand Up @@ -119,7 +119,11 @@ export function route(
}

if (isPublic) {
routesModule.routes.push(self)
if (self.matchLast) {
routesModule.routes.unshift(self)
} else {
routesModule.routes.push(self)
}
} else {
// TODO: support nesting of catch-all and error routes
if (routeStack.length)
Expand Down
4 changes: 4 additions & 0 deletions src/runtime/routeTypes.ts
Expand Up @@ -67,6 +67,10 @@ export interface RouteConfig<
* their path params.
*/
paths?: () => Promisable<readonly StaticPageParams<Params>[]>
/**
* If true, this route will run after every route already declared.
*/
matchLast?: boolean
/**
* If intermediate state is shared between the `state`, `include`,
* and/or `headProps` options, define a `config` function to avoid
Expand Down

0 comments on commit df7422e

Please sign in to comment.