Skip to content

Commit

Permalink
fix: onRoutesGenerated should only execute after new generation
Browse files Browse the repository at this point in the history
  • Loading branch information
hannoeru committed Apr 22, 2021
1 parent 6b3ba60 commit 2cd2707
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ function routePlugin(userOptions: UserOptions = {}): Plugin {
const routes = generateRoutes(files, pageDir, options)
generatedRoutes = generatedRoutes.concat(routes)
}
// only execute onRoutesGenerated once
generatedRoutes = (await options.onRoutesGenerated?.(generatedRoutes)) || generatedRoutes
}
debug.gen('routes: %O', generatedRoutes)

generatedRoutes = (await options.onRoutesGenerated?.(generatedRoutes)) || generatedRoutes

let clientCode = generateClientCode(generatedRoutes, options)
// debug.gen('client code: %O', clientCode)

Expand Down

0 comments on commit 2cd2707

Please sign in to comment.