Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 093d77c

Browse files
committed
fix: fix ssr data serve
1 parent f2fc225 commit 093d77c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

server/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,10 @@ export class Application implements ServerApplication {
455455
}
456456

457457
const cacheKey = router.pathname + router.query.toString()
458-
const ret = await this.#renderer.useCache(pagePath, cacheKey, async () => {
458+
const [_, data] = await this.#renderer.useCache(pagePath, cacheKey, async () => {
459459
return await this.#renderer.renderPage(router, nestedModules)
460460
})
461-
return ret[1]
461+
return data
462462
}
463463

464464
/** get ssr page */

server/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ export class Server {
8585
if (p === '/index') {
8686
p = '/'
8787
}
88-
const [status, data] = await app.getSSRData({ pathname: p })
89-
if (status === 200) {
90-
req.send(JSON.stringify(data), 'application/json; charset=utf-8')
88+
const data = await app.getSSRData({ pathname: p })
89+
if (data === null) {
90+
req.status(404).send('null', 'application/json; charset=utf-8')
9191
} else {
92-
req.status(status).send('')
92+
req.send(JSON.stringify(data), 'application/json; charset=utf-8')
9393
}
9494
return
9595
}

0 commit comments

Comments
 (0)