Skip to content

Commit

Permalink
fix: router not generating same path for renamed index as for index f…
Browse files Browse the repository at this point in the history
…ile (#1020)

* add trailing slash to path of routes with renamed index

* use same regex as toPath

---------

Co-authored-by: Ryan Carniato <ryansolid@gmail.com>
  • Loading branch information
edivados and ryansolid authored Aug 23, 2023
1 parent 6d4eb2b commit 4804a72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/start/fs-router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ export class Router {
log("processing", path);
let routeConfig = this.createRouteConfig(path);

// renamed index should have a trailing slash like index files
if (!routeConfig.path.endsWith("/") && /\/\([^)/]+\)$/.test(routeConfig.id)) {
routeConfig.path += "/";
}

if (this.routes[routeConfig.id]) {
// get old config, we want to compare the oldConfig with the new one to
// detect changes and restart the vite server
Expand Down

0 comments on commit 4804a72

Please sign in to comment.