You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fizz][Float] Do not write after closing the stream (#27541)
Float methods can hang on to a reference to a Request after the request
is closed due to AsyncLocalStorage. If a Float method is called at this
point we do not want to attempt to flush anything. This change updates
the closing logic to also call `stopFlowing` which will ensure that any
checks against the destination properly reflect that we cannot do any
writes. In addition it updates the enqueueFlush logic to existence check
the destination inside the work function since it can change across the
work scheduling gap if it is async.
fixes: #27540
DiffTrain build for [601e5c3](601e5c3)
@@ -4930,16 +4930,17 @@ function flushCompletedQueues(request, destination) {
4930
4930
0===request.clientRenderedBoundaries.length&&
4931
4931
0===request.completedBoundaries.length&&
4932
4932
((request.flushScheduled=!1),
4933
-
(request=request.resumableState),
4934
-
request.hasBody&&
4933
+
(i=request.resumableState),
4934
+
i.hasBody&&
4935
4935
(destination.push("</"),
4936
4936
destination.push("body"),
4937
4937
destination.push(">")),
4938
-
request.hasHtml&&
4938
+
i.hasHtml&&
4939
4939
(destination.push("</"),
4940
4940
destination.push("html"),
4941
4941
destination.push(">")),
4942
-
destination.push(null));
4942
+
destination.push(null),
4943
+
(request.destination=null));
4943
4944
}
4944
4945
}
4945
4946
functionenqueueFlush(request){
@@ -4948,9 +4949,11 @@ function enqueueFlush(request) {
4948
4949
0===request.pingedTasks.length&&
4949
4950
null!==request.destination
4950
4951
){
4951
-
vardestination=request.destination;
4952
4952
request.flushScheduled=!0;
4953
-
flushCompletedQueues(request,destination);
4953
+
vardestination=request.destination;
4954
+
destination
4955
+
? flushCompletedQueues(request,destination)
4956
+
: (request.flushScheduled=!1);
4954
4957
}
4955
4958
}
4956
4959
functionabort(request,reason){
@@ -5050,4 +5053,4 @@ exports.renderToString = function (children, options) {
5050
5053
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
@@ -4865,16 +4865,17 @@ function flushCompletedQueues(request, destination) {
4865
4865
0===request.clientRenderedBoundaries.length&&
4866
4866
0===request.completedBoundaries.length&&
4867
4867
((request.flushScheduled=!1),
4868
-
(request=request.resumableState),
4869
-
request.hasBody&&
4868
+
(i=request.resumableState),
4869
+
i.hasBody&&
4870
4870
(destination.push("</"),
4871
4871
destination.push("body"),
4872
4872
destination.push(">")),
4873
-
request.hasHtml&&
4873
+
i.hasHtml&&
4874
4874
(destination.push("</"),
4875
4875
destination.push("html"),
4876
4876
destination.push(">")),
4877
-
destination.push(null));
4877
+
destination.push(null),
4878
+
(request.destination=null));
4878
4879
}
4879
4880
}
4880
4881
functionenqueueFlush(request){
@@ -4883,9 +4884,11 @@ function enqueueFlush(request) {
4883
4884
0===request.pingedTasks.length&&
4884
4885
null!==request.destination
4885
4886
){
4886
-
vardestination=request.destination;
4887
4887
request.flushScheduled=!0;
4888
-
flushCompletedQueues(request,destination);
4888
+
vardestination=request.destination;
4889
+
destination
4890
+
? flushCompletedQueues(request,destination)
4891
+
: (request.flushScheduled=!1);
4889
4892
}
4890
4893
}
4891
4894
functionabort(request,reason){
@@ -4985,4 +4988,4 @@ exports.renderToString = function (children, options) {
4985
4988
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
0 commit comments