Skip to content

Commit 26f3e58

Browse files
committed
Stop flowing and then abort if a stream is cancelled (#27405)
We currently abort a stream either it's explicitly told to abort (e.g. by an abortsignal). In this case we still finish writing what we have as well as instructions for the client about what happened so it can trigger fallback cases and log appropriately. We also abort a request if the stream itself cancels. E.g. if you can't write anymore. In this case we should not write anything to the outgoing stream since it's supposed to be closed already now. However, we should still abort the request so that more work isn't performed and so that we can log the reason for it to the onError callback. We should also not do any work after aborting. There we need to stop the "flow" of bytes - so I call stopFlowing in the cancel case before aborting. The tests were testing this case but we had changed the implementation to only start flowing at initial read (pull) instead of start like we used to. As a result, it was no longer covering this case. We have to call reader.read() in the tests to start the flow so that we need to cancel it. We also were missing a final assertion on the error logs and since we were tracking them explicitly the extra error was silenced. DiffTrain build for [d9e00f7](d9e00f7)
1 parent 109381d commit 26f3e58

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
68ac6dbcf8d58a67e94e9061395dd96a52d92377
1+
d9e00f795b77676fb14f2a3c6f421f48f73bec2a

compiled/facebook-www/ReactDOMServer-dev.classic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (__DEV__) {
1919
var React = require("react");
2020
var ReactDOM = require("react-dom");
2121

22-
var ReactVersion = "18.3.0-www-classic-24cad190";
22+
var ReactVersion = "18.3.0-www-classic-8314963c";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -13120,7 +13120,7 @@ function startFlowing(request, destination) {
1312013120
logRecoverableError(request, error);
1312113121
fatalError(request, error);
1312213122
}
13123-
} // This is called to early terminate a request. It puts all pending boundaries in client rendered state.
13123+
}
1312413124

1312513125
function abort(request, reason) {
1312613126
try {

compiled/facebook-www/ReactDOMServer-dev.modern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (__DEV__) {
1919
var React = require("react");
2020
var ReactDOM = require("react-dom");
2121

22-
var ReactVersion = "18.3.0-www-modern-0d8cdce2";
22+
var ReactVersion = "18.3.0-www-modern-4ddb3d62";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -12868,7 +12868,7 @@ function startFlowing(request, destination) {
1286812868
logRecoverableError(request, error);
1286912869
fatalError(request, error);
1287012870
}
12871-
} // This is called to early terminate a request. It puts all pending boundaries in client rendered state.
12871+
}
1287212872

1287312873
function abort(request, reason) {
1287412874
try {

compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12738,7 +12738,7 @@ function startFlowing(request, destination) {
1273812738
logRecoverableError(request, error);
1273912739
fatalError(request, error);
1274012740
}
12741-
} // This is called to early terminate a request. It puts all pending boundaries in client rendered state.
12741+
}
1274212742

1274312743
function abort(request, reason) {
1274412744
try {

compiled/facebook-www/ReactTestRenderer-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24360,7 +24360,7 @@ function createFiberRoot(
2436024360
return root;
2436124361
}
2436224362

24363-
var ReactVersion = "18.3.0-www-modern-959bcb71";
24363+
var ReactVersion = "18.3.0-www-modern-9ffb854c";
2436424364

2436524365
// Might add PROFILE later.
2436624366

0 commit comments

Comments
 (0)