Skip to content

Commit 20d1a82

Browse files
Cherry-pick #295 from dev to main (#360)
Co-authored-by: Leanid Shutau <leanidshutau@gmail.com>
1 parent 42289fa commit 20d1a82

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

.changeset/chilly-shoes-cheat.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@fastify/react": patch
3+
"@fastify/vue": patch
4+
---
5+
6+
#295 fix: return reply in async handlers

examples/react-next-mini/renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function createRoute({ handler, errorHandler, route }, scope, config) {
1515
if (route.getServerSideProps) {
1616
// If getServerSideProps is provided, register JSON endpoint for it
1717
scope.get(`/json${route.path}`, async (req, reply) => {
18-
reply.send(
18+
return reply.send(
1919
await route.getServerSideProps({
2020
req,
2121
fetchJSON: scope.fetchJSON,

examples/vue-next-mini/renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function createRoute({ handler, errorHandler, route }, scope, config) {
2323
if (route.getServerSideProps) {
2424
// If getServerSideProps is provided, register JSON endpoint for it
2525
scope.get(`/json${route.path}`, async (req, reply) => {
26-
reply.send(
26+
return reply.send(
2727
await route.getServerSideProps({
2828
req,
2929
ky: scope.ky,

packages/fastify-react/routing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export async function createRoute({ client, errorHandler, route }, scope, config
134134
scope.get(`/-/data${routePath}`, {
135135
onRequest,
136136
async handler(req, reply) {
137-
reply.send(await route.getData(req.route))
137+
return reply.send(await route.getData(req.route))
138138
},
139139
})
140140
}

packages/fastify-vue/routing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export async function createRoute({ client, errorHandler, route }, scope, config
140140
scope.get(`/-/data${routePath}`, {
141141
onRequest,
142142
async handler(req, reply) {
143-
reply.send(await route.getData(req.route))
143+
return reply.send(await route.getData(req.route))
144144
},
145145
})
146146
}

0 commit comments

Comments
 (0)