diff --git a/package.json b/package.json
index 53f56641fbdcc..71f8a7e73a484 100644
--- a/package.json
+++ b/package.json
@@ -194,16 +194,16 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:react@17.0.2",
- "react-builtin": "npm:react@18.3.0-canary-a41957507-20231017",
+ "react-builtin": "npm:react@18.3.0-canary-d803f519e-20231020",
"react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2",
- "react-dom-builtin": "npm:react-dom@18.3.0-canary-a41957507-20231017",
- "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-a41957507-20231017",
- "react-experimental-builtin": "npm:react@0.0.0-experimental-a41957507-20231017",
- "react-server-dom-turbopack": "18.3.0-canary-a41957507-20231017",
- "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-a41957507-20231017",
- "react-server-dom-webpack": "18.3.0-canary-a41957507-20231017",
- "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-a41957507-20231017",
+ "react-dom-builtin": "npm:react-dom@18.3.0-canary-d803f519e-20231020",
+ "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-d803f519e-20231020",
+ "react-experimental-builtin": "npm:react@0.0.0-experimental-d803f519e-20231020",
+ "react-server-dom-turbopack": "18.3.0-canary-d803f519e-20231020",
+ "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-d803f519e-20231020",
+ "react-server-dom-webpack": "18.3.0-canary-d803f519e-20231020",
+ "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-d803f519e-20231020",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
@@ -213,8 +213,8 @@
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.6",
- "scheduler-builtin": "npm:scheduler@0.24.0-canary-a41957507-20231017",
- "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-a41957507-20231017",
+ "scheduler-builtin": "npm:scheduler@0.24.0-canary-d803f519e-20231020",
+ "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-d803f519e-20231020",
"seedrandom": "3.0.5",
"selenium-webdriver": "4.0.0-beta.4",
"semver": "7.3.7",
diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js
index 0fa29c5711881..d931cac2fd243 100644
--- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js
+++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js
@@ -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-a41957507-20231017';
+var ReactVersion = '18.3.0-experimental-d803f519e-20231020';
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
@@ -11256,7 +11256,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);
}
}
}
@@ -11276,10 +11279,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;
+ }
});
}
}
@@ -11309,6 +11319,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 {
diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js
index 2c549a83c8060..2f966742637a4 100644
--- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js
+++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js
@@ -188,8 +188,8 @@ b);q.highImagePreloads.clear();q.styles.forEach(lc,b);q.scripts.forEach(K,b);q.s
ba?(q.push(V.startInlineScript),0===(A.instructions&4)?(A.instructions|=4,q.push('$RX=function(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};;$RX("')):q.push('$RX("')):q.push('"):!q.push('">')){a.destination=null;c++;O.splice(0,c);return}}O.splice(0,c);var W=a.completedBoundaries;for(c=0;c")),a.hasHtml&&(b.push(""),b.push("html"),b.push(">"))),b.push(null))}}function oc(a){if(!1===a.flushScheduled&&0===a.pingedTasks.length&&null!==a.destination){var b=a.destination;a.flushScheduled=!0;Oe(a,b)}}
+0===a.clientRenderedBoundaries.length&&0===a.completedBoundaries.length&&(a.flushScheduled=!1,null===a.trackedPostpones&&(c=a.resumableState,c.hasBody&&(b.push(""),b.push("body"),b.push(">")),c.hasHtml&&(b.push(""),b.push("html"),b.push(">"))),b.push(null),a.destination=null)}}function oc(a){if(!1===a.flushScheduled&&0===a.pingedTasks.length&&null!==a.destination){a.flushScheduled=!0;var b=a.destination;b?Oe(a,b):a.flushScheduled=!1}}
function Ue(a,b){try{var c=a.abortableTasks;if(0"):!p.push('">')){a.destination=null;c++;N.splice(0,c);return}}N.splice(0,c);var V=a.completedBoundaries;for(c=0;c")),a.hasHtml&&(b.push(""),b.push("html"),b.push(">"))),b.push(null))}}function pc(a){if(!1===a.flushScheduled&&0===a.pingedTasks.length&&null!==a.destination){var b=a.destination;a.flushScheduled=!0;Pe(a,b)}}
+0===a.clientRenderedBoundaries.length&&0===a.completedBoundaries.length&&(a.flushScheduled=!1,null===a.trackedPostpones&&(c=a.resumableState,c.hasBody&&(b.push(""),b.push("body"),b.push(">")),c.hasHtml&&(b.push(""),b.push("html"),b.push(">"))),b.push(null),a.destination=null)}}function pc(a){if(!1===a.flushScheduled&&0===a.pingedTasks.length&&null!==a.destination){a.flushScheduled=!0;var b=a.destination;b?Pe(a,b):a.flushScheduled=!1}}
function Ve(a,b){if(1===a.status)a.status=2,b.destroy(a.fatalError);else if(2!==a.status&&null===a.destination){a.destination=b;try{Pe(a,b)}catch(c){W(a,c),Ae(a,c)}}}function We(a,b){try{var c=a.abortableTasks;if(0'),cb=A("