@@ -379,7 +379,6 @@ export async function handleAction({
379
379
requestStore,
380
380
serverActions,
381
381
ctx,
382
- temporaryReferences,
383
382
} : {
384
383
req : BaseNextRequest
385
384
res : BaseNextResponse
@@ -390,7 +389,6 @@ export async function handleAction({
390
389
requestStore : RequestStore
391
390
serverActions ?: ServerActionsConfig
392
391
ctx : AppRenderContext
393
- temporaryReferences : unknown
394
392
} ) : Promise <
395
393
| undefined
396
394
| {
@@ -400,6 +398,7 @@ export async function handleAction({
400
398
type : 'done'
401
399
result : RenderResult | undefined
402
400
formState ?: any
401
+ temporaryReferences : unknown
403
402
}
404
403
> {
405
404
const contentType = req . headers [ 'content-type' ]
@@ -515,6 +514,7 @@ export async function handleAction({
515
514
// if the page was not revalidated, we can skip the rendering the flight tree
516
515
skipFlight : ! staticGenerationStore . pathWasRevalidated ,
517
516
} ) ,
517
+ temporaryReferences : undefined ,
518
518
}
519
519
}
520
520
@@ -556,6 +556,7 @@ export async function handleAction({
556
556
ctx . renderOpts . basePath ,
557
557
staticGenerationStore
558
558
) ,
559
+ temporaryReferences : undefined ,
559
560
}
560
561
}
561
562
}
@@ -569,10 +570,16 @@ export async function handleAction({
569
570
isWebNextRequest ( req )
570
571
) {
571
572
// Use react-server-dom-webpack/server.edge
572
- const { decodeReply, decodeAction, decodeFormState } = ComponentMod
573
+ const {
574
+ createTemporaryReferenceSet,
575
+ decodeReply,
576
+ decodeAction,
577
+ decodeFormState,
578
+ } = ComponentMod
573
579
if ( ! req . body ) {
574
580
throw new Error ( 'invariant: Missing request body.' )
575
581
}
582
+ const temporaryReferences = createTemporaryReferenceSet ( )
576
583
577
584
// TODO: add body limit
578
585
@@ -581,7 +588,7 @@ export async function handleAction({
581
588
const formData = await req . request . formData ( )
582
589
if ( isFetchAction ) {
583
590
bound = await decodeReply ( formData , serverModuleMap , {
584
- temporaryReferences : temporaryReferences ,
591
+ temporaryReferences,
585
592
} )
586
593
} else {
587
594
const action = await decodeAction ( formData , serverModuleMap )
@@ -622,11 +629,11 @@ export async function handleAction({
622
629
if ( isURLEncodedAction ) {
623
630
const formData = formDataFromSearchQueryString ( actionData )
624
631
bound = await decodeReply ( formData , serverModuleMap , {
625
- temporaryReferences : temporaryReferences ,
632
+ temporaryReferences,
626
633
} )
627
634
} else {
628
635
bound = await decodeReply ( actionData , serverModuleMap , {
629
- temporaryReferences : temporaryReferences ,
636
+ temporaryReferences,
630
637
} )
631
638
}
632
639
}
@@ -638,11 +645,13 @@ export async function handleAction({
638
645
) {
639
646
// Use react-server-dom-webpack/server.node which supports streaming
640
647
const {
648
+ createTemporaryReferenceSet,
641
649
decodeReply,
642
650
decodeReplyFromBusboy,
643
651
decodeAction,
644
652
decodeFormState,
645
653
} = require ( `./react-server.node` )
654
+ const temporaryReferences = createTemporaryReferenceSet ( )
646
655
647
656
const { Transform } =
648
657
require ( 'node:stream' ) as typeof import ( 'node:stream' )
@@ -748,11 +757,11 @@ export async function handleAction({
748
757
if ( isURLEncodedAction ) {
749
758
const formData = formDataFromSearchQueryString ( actionData )
750
759
bound = await decodeReply ( formData , serverModuleMap , {
751
- temporaryReferences : temporaryReferences ,
760
+ temporaryReferences,
752
761
} )
753
762
} else {
754
763
bound = await decodeReply ( actionData , serverModuleMap , {
755
- temporaryReferences : temporaryReferences ,
764
+ temporaryReferences,
756
765
} )
757
766
}
758
767
}
@@ -813,6 +822,7 @@ export async function handleAction({
813
822
type : 'done' ,
814
823
result : actionResult ,
815
824
formState,
825
+ temporaryReferences : undefined ,
816
826
}
817
827
} catch ( err ) {
818
828
if ( isRedirectError ( err ) ) {
@@ -839,6 +849,7 @@ export async function handleAction({
839
849
ctx . renderOpts . basePath ,
840
850
staticGenerationStore
841
851
) ,
852
+ temporaryReferences : undefined ,
842
853
}
843
854
}
844
855
@@ -856,6 +867,7 @@ export async function handleAction({
856
867
return {
857
868
type : 'done' ,
858
869
result : RenderResult . fromStatic ( '' ) ,
870
+ temporaryReferences : undefined ,
859
871
}
860
872
} else if ( isNotFoundError ( err ) ) {
861
873
res . statusCode = 404
@@ -883,6 +895,7 @@ export async function handleAction({
883
895
actionResult : promise ,
884
896
asNotFound : true ,
885
897
} ) ,
898
+ temporaryReferences : undefined ,
886
899
}
887
900
}
888
901
return {
@@ -917,6 +930,7 @@ export async function handleAction({
917
930
skipFlight :
918
931
! staticGenerationStore . pathWasRevalidated || actionWasForwarded ,
919
932
} ) ,
933
+ temporaryReferences : undefined ,
920
934
}
921
935
}
922
936
0 commit comments