Skip to content

Commit

Permalink
fix(ssg): fixed isDynamicRoute and ssgParams matter (#2006)
Browse files Browse the repository at this point in the history
* fix(ssg): fixed `isDynamicRoute` and `ssgParams` matter

* denoify
  • Loading branch information
yusukebe committed Jan 17, 2024
1 parent f232483 commit 19259d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion deno_dist/helper/ssg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ export const fetchRoutesContent = async <
const baseURL = 'http://localhost'

for (const route of inspectRoutes(app)) {
if (route.isMiddleware || isDynamicRoute(route.path)) continue
if (route.isMiddleware) continue

// GET Route Info
const thisRouteBaseURL = new URL(route.path, baseURL).toString()
const forGetInfoURLRequest = new Request(thisRouteBaseURL) as AddedSSGDataRequest
await app.fetch(forGetInfoURLRequest)

if (!forGetInfoURLRequest.ssgParams) {
if (isDynamicRoute(route.path)) continue
forGetInfoURLRequest.ssgParams = [{}]
}

Expand Down
3 changes: 2 additions & 1 deletion src/helper/ssg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ export const fetchRoutesContent = async <
const baseURL = 'http://localhost'

for (const route of inspectRoutes(app)) {
if (route.isMiddleware || isDynamicRoute(route.path)) continue
if (route.isMiddleware) continue

// GET Route Info
const thisRouteBaseURL = new URL(route.path, baseURL).toString()
const forGetInfoURLRequest = new Request(thisRouteBaseURL) as AddedSSGDataRequest
await app.fetch(forGetInfoURLRequest)

if (!forGetInfoURLRequest.ssgParams) {
if (isDynamicRoute(route.path)) continue
forGetInfoURLRequest.ssgParams = [{}]
}

Expand Down

0 comments on commit 19259d3

Please sign in to comment.