Skip to content

Commit 6de8dcc

Browse files
committed
1 parent e517c21 commit 6de8dcc

File tree

3 files changed

+224
-126
lines changed

3 files changed

+224
-126
lines changed

packages/next/src/server/app-render/action-handler.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { RequestStore } from '../../client/components/request-async-storage
44
import type { AppRenderContext, GenerateFlight } from './app-render'
55
import type { AppPageModule } from '../../server/route-modules/app-page/module'
66
import type { BaseNextRequest, BaseNextResponse } from '../base-http'
7+
import type { RequestErrorContext } from '../instrumentation/types'
78

89
import {
910
RSC_HEADER,
@@ -403,6 +404,7 @@ type ServerActionsConfig = {
403404
export async function handleAction({
404405
req,
405406
res,
407+
errorContext,
406408
ComponentMod,
407409
serverModuleMap,
408410
generateFlight,
@@ -413,6 +415,10 @@ export async function handleAction({
413415
}: {
414416
req: BaseNextRequest
415417
res: BaseNextResponse
418+
errorContext: Pick<
419+
RequestErrorContext,
420+
'routerKind' | 'routePath' | 'routeType'
421+
>
416422
ComponentMod: AppPageModule
417423
serverModuleMap: ServerModuleMap
418424
generateFlight: GenerateFlight
@@ -539,7 +545,7 @@ export async function handleAction({
539545

540546
return {
541547
type: 'done',
542-
result: await generateFlight(ctx, {
548+
result: await generateFlight(req, ctx, errorContext, {
543549
actionResult: promise,
544550
// if the page was not revalidated, we can skip the rendering the flight tree
545551
skipFlight: !staticGenerationStore.pathWasRevalidated,
@@ -817,7 +823,7 @@ export async function handleAction({
817823
requestStore,
818824
})
819825

820-
actionResult = await generateFlight(ctx, {
826+
actionResult = await generateFlight(req, ctx, errorContext, {
821827
actionResult: Promise.resolve(returnVal),
822828
// if the page was not revalidated, or if the action was forwarded from another worker, we can skip the rendering the flight tree
823829
skipFlight:
@@ -895,7 +901,7 @@ export async function handleAction({
895901
}
896902
return {
897903
type: 'done',
898-
result: await generateFlight(ctx, {
904+
result: await generateFlight(req, ctx, errorContext, {
899905
skipFlight: false,
900906
actionResult: promise,
901907
asNotFound: true,
@@ -928,7 +934,7 @@ export async function handleAction({
928934

929935
return {
930936
type: 'done',
931-
result: await generateFlight(ctx, {
937+
result: await generateFlight(req, ctx, errorContext, {
932938
actionResult: promise,
933939
// if the page was not revalidated, or if the action was forwarded from another worker, we can skip the rendering the flight tree
934940
skipFlight:

0 commit comments

Comments
 (0)