Skip to content

Commit e46929f

Browse files
committed
[Flight] Move pendingChunks ref count increment into createTask (#28260)
Every time we create a task we need to wait for it so we increase a ref count. We can do this in `createTask`. This is in line with what Fizz does too. They differ in that Flight counts when they're actually flushed where as Fizz decrements them when they complete. Flight should probably count them when they complete so it's possible to wait for the end before flushing for buffering purposes. DiffTrain build for [0d11563](0d11563)
1 parent aa5199b commit e46929f

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
66924457594bc28eb2f3f39c7c61d54b931c188e
1+
0d11563b4a96e0f4f2361cdf7375b12375688163

compiled/facebook-www/ReactDOMTesting-prod.modern.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17067,7 +17067,7 @@ Internals.Events = [
1706717067
var devToolsConfig$jscomp$inline_1787 = {
1706817068
findFiberByHostInstance: getClosestInstanceFromNode,
1706917069
bundleType: 0,
17070-
version: "18.3.0-www-modern-280d1df6",
17070+
version: "18.3.0-www-modern-941395b7",
1707117071
rendererPackageName: "react-dom"
1707217072
};
1707317073
var internals$jscomp$inline_2160 = {
@@ -17098,7 +17098,7 @@ var internals$jscomp$inline_2160 = {
1709817098
scheduleRoot: null,
1709917099
setRefreshHandler: null,
1710017100
getCurrentFiber: null,
17101-
reconcilerVersion: "18.3.0-www-modern-280d1df6"
17101+
reconcilerVersion: "18.3.0-www-modern-941395b7"
1710217102
};
1710317103
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1710417104
var hook$jscomp$inline_2161 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17526,4 +17526,4 @@ exports.useFormStatus = function () {
1752617526
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
1752717527
throw Error(formatProdErrorMessage(248));
1752817528
};
17529-
exports.version = "18.3.0-www-modern-280d1df6";
17529+
exports.version = "18.3.0-www-modern-941395b7";

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,6 @@ if (__DEV__) {
11461146
onPostpone:
11471147
onPostpone === undefined ? defaultPostponeHandler : onPostpone
11481148
};
1149-
request.pendingChunks++;
11501149
var rootTask = createTask(request, model, null, false, abortSet);
11511150
pingedTasks.push(rootTask);
11521151
return request;
@@ -1159,7 +1158,6 @@ if (__DEV__) {
11591158
}
11601159

11611160
function serializeThenable(request, task, thenable) {
1162-
request.pendingChunks++;
11631161
var newTask = createTask(
11641162
request,
11651163
null,
@@ -1550,6 +1548,7 @@ if (__DEV__) {
15501548
}
15511549

15521550
function createTask(request, model, keyPath, implicitSlot, abortSet) {
1551+
request.pendingChunks++;
15531552
var id = request.nextChunkId++;
15541553

15551554
if (typeof model === "object" && model !== null) {
@@ -1733,7 +1732,6 @@ if (__DEV__) {
17331732
}
17341733

17351734
function outlineModel(request, value) {
1736-
request.pendingChunks++;
17371735
var newTask = createTask(
17381736
request,
17391737
value,
@@ -1856,7 +1854,6 @@ if (__DEV__) {
18561854
// $FlowFixMe[method-unbinding]
18571855
if (typeof x.then === "function") {
18581856
// Something suspended, we'll need to create a new task and resolve it later.
1859-
request.pendingChunks++;
18601857
var newTask = createTask(
18611858
request,
18621859
task.model,

compiled/facebook-www/ReactFlightDOMServer-prod.modern.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ function defaultErrorHandler(error) {
450450
function defaultPostponeHandler() {}
451451
var currentRequest = null;
452452
function serializeThenable(request, task, thenable) {
453-
request.pendingChunks++;
454453
var newTask = createTask(
455454
request,
456455
null,
@@ -649,6 +648,7 @@ function pingTask(request, task) {
649648
performWork(request));
650649
}
651650
function createTask(request, model, keyPath, implicitSlot, abortSet) {
651+
request.pendingChunks++;
652652
var id = request.nextChunkId++;
653653
"object" !== typeof model ||
654654
null === model ||
@@ -691,7 +691,6 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
691691
null !== parentPropertyName &&
692692
"function" === typeof parentPropertyName.then)
693693
) {
694-
request.pendingChunks++;
695694
JSCompiler_inline_result = createTask(
696695
request,
697696
task.model,
@@ -773,7 +772,6 @@ function serializeClientReference(
773772
}
774773
}
775774
function outlineModel(request, value) {
776-
request.pendingChunks++;
777775
value = createTask(request, value, null, !1, request.abortableTasks);
778776
retryTask(request, value);
779777
return value.id;
@@ -1122,7 +1120,6 @@ exports.renderToDestination = function (destination, model, options) {
11221120
onError: void 0 === onError ? defaultErrorHandler : onError,
11231121
onPostpone: defaultPostponeHandler
11241122
};
1125-
onError.pendingChunks++;
11261123
model = createTask(onError, model, null, !1, abortSet);
11271124
options.push(model);
11281125
onError.flushScheduled = null !== onError.destination;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26083,7 +26083,7 @@ if (__DEV__) {
2608326083
return root;
2608426084
}
2608526085

26086-
var ReactVersion = "18.3.0-www-modern-895f9e13";
26086+
var ReactVersion = "18.3.0-www-modern-6f034660";
2608726087

2608826088
// Might add PROFILE later.
2608926089

0 commit comments

Comments
 (0)