Skip to content

Commit

Permalink
Patch React with fix for write-after-close for ReadableStream (#57011)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff authored Oct 18, 2023
1 parent 54145b4 commit 40965eb
Show file tree
Hide file tree
Showing 34 changed files with 205 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require("next/dist/compiled/react-experimental");
var ReactDOM = require('react-dom');

var ReactVersion = '18.3.0-experimental-d900fadbf-20230929';
var ReactVersion = '18.3.0-experimental-3cfcbc5bc-20231018';

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

Expand Down Expand Up @@ -11264,7 +11264,10 @@ function flushCompletedQueues(request, destination) {
} // We're done.


close(destination);
close(destination); // We need to stop flowing now because we do not want any async contexts which might call
// float methods to initiate any flushes after this point

stopFlowing(request);
}
}
}
Expand All @@ -11284,10 +11287,17 @@ function enqueueFlush(request) {
request.pingedTasks.length === 0 && // If there is no destination there is nothing we can flush to. A flush will
// happen when we start flowing again
request.destination !== null) {
var destination = request.destination;
request.flushScheduled = true;
scheduleWork(function () {
return flushCompletedQueues(request, destination);
// We need to existence check destination again here because it might go away
// in between the enqueueFlush call and the work execution
var destination = request.destination;

if (destination) {
flushCompletedQueues(request, destination);
} else {
request.flushScheduled = false;
}
});
}
}
Expand Down Expand Up @@ -11317,6 +11327,9 @@ function startFlowing(request, destination) {
fatalError(request, error);
}
}
function stopFlowing(request) {
request.destination = null;
} // This is called to early terminate a request. It puts all pending boundaries in client rendered state.

function abort(request, reason) {
try {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var React = require("next/dist/compiled/react-experimental");
var ReactDOM = require('react-dom');
var stream = require('stream');

var ReactVersion = '18.3.0-experimental-d900fadbf-20230929';
var ReactVersion = '18.3.0-experimental-3cfcbc5bc-20231018';

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

Expand Down Expand Up @@ -11265,7 +11265,10 @@ function flushCompletedQueues(request, destination) {
} // We're done.


close(destination);
close(destination); // We need to stop flowing now because we do not want any async contexts which might call
// float methods to initiate any flushes after this point

stopFlowing(request);
}
}
}
Expand All @@ -11285,10 +11288,17 @@ function enqueueFlush(request) {
request.pingedTasks.length === 0 && // If there is no destination there is nothing we can flush to. A flush will
// happen when we start flowing again
request.destination !== null) {
var destination = request.destination;
request.flushScheduled = true;
scheduleWork(function () {
return flushCompletedQueues(request, destination);
// We need to existence check destination again here because it might go away
// in between the enqueueFlush call and the work execution
var destination = request.destination;

if (destination) {
flushCompletedQueues(request, destination);
} else {
request.flushScheduled = false;
}
});
}
}
Expand Down Expand Up @@ -11318,6 +11328,9 @@ function startFlowing(request, destination) {
fatalError(request, error);
}
}
function stopFlowing(request) {
request.destination = null;
} // This is called to early terminate a request. It puts all pending boundaries in client rendered state.

function abort(request, reason) {
try {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (process.env.NODE_ENV !== "production") {

var React = require("next/dist/compiled/react-experimental");

var ReactVersion = '18.3.0-experimental-d900fadbf-20230929';
var ReactVersion = '18.3.0-experimental-3cfcbc5bc-20231018';

var Internals = {
usingClientEntryPoint: false,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require("next/dist/compiled/react-experimental");
var ReactDOM = require('react-dom');

var ReactVersion = '18.3.0-experimental-d900fadbf-20230929';
var ReactVersion = '18.3.0-experimental-3cfcbc5bc-20231018';

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

Expand Down Expand Up @@ -11320,7 +11320,10 @@ function flushCompletedQueues(request, destination) {
} // We're done.


close(destination);
close(destination); // We need to stop flowing now because we do not want any async contexts which might call
// float methods to initiate any flushes after this point

stopFlowing(request);
} else {
completeWriting(destination);
}
Expand All @@ -11342,10 +11345,17 @@ function enqueueFlush(request) {
request.pingedTasks.length === 0 && // If there is no destination there is nothing we can flush to. A flush will
// happen when we start flowing again
request.destination !== null) {
var destination = request.destination;
request.flushScheduled = true;
scheduleWork(function () {
return flushCompletedQueues(request, destination);
// We need to existence check destination again here because it might go away
// in between the enqueueFlush call and the work execution
var destination = request.destination;

if (destination) {
flushCompletedQueues(request, destination);
} else {
request.flushScheduled = false;
}
});
}
}
Expand Down
Loading

0 comments on commit 40965eb

Please sign in to comment.