From fe4d7ee0fb08db3533f299fdf2669dfb38465a82 Mon Sep 17 00:00:00 2001 From: sebmarkbage Date: Wed, 20 Sep 2023 16:27:03 +0000 Subject: [PATCH] [Fizz] Ensure Resumable State is Serializable (#27388) Moves writing queues to renderState. We shouldn't need the resource tracking's value. We just need to know if that resource has already been emitted. We can use a Set for this. To ensure that set is directly serializable we can just use a dictionary-like object with no value. See individual commits for special cases. DiffTrain build for [b775564d35d6fe9f9acead0f380bbc86bb6bdd2c](https://github.com/facebook/react/commit/b775564d35d6fe9f9acead0f380bbc86bb6bdd2c) --- compiled/facebook-www/REVISION | 2 +- .../ReactDOMServer-dev.classic.js | 604 ++++++------ .../facebook-www/ReactDOMServer-dev.modern.js | 604 ++++++------ .../ReactDOMServer-prod.classic.js | 909 +++++++----------- .../ReactDOMServer-prod.modern.js | 909 +++++++----------- .../ReactDOMServerStreaming-dev.modern.js | 585 ++++++----- .../ReactDOMServerStreaming-prod.modern.js | 904 +++++++++-------- .../ReactTestRenderer-dev.modern.js | 2 +- 8 files changed, 2178 insertions(+), 2341 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index bbaaa0dcdb..585d5cc297 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -2807d781a08db8e9873687fccc25c0f12b4fb3d4 +b775564d35d6fe9f9acead0f380bbc86bb6bdd2c diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 3e632bac8f..181b3579cf 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.classic.js +++ b/compiled/facebook-www/ReactDOMServer-dev.classic.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); -var ReactVersion = "18.3.0-www-classic-3e4fe4e2"; +var ReactVersion = "18.3.0-www-classic-cc6e6575"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -1931,7 +1931,15 @@ var importMapScriptEnd = stringToPrecomputedChunk(""); // Allows us to // if passed externalRuntimeConfig and the enableFizzExternalRuntime feature flag // is set, the server will send instructions via data attributes (instead of inline scripts) -function createRenderState$1(resumableState, nonce, importMap) { +function createRenderState$1( + resumableState, + nonce, + bootstrapScriptContent, + bootstrapScripts, + bootstrapModules, + externalRuntimeConfig, + importMap +) { var inlineScriptWithNonce = nonce === undefined ? startInlineScript @@ -1939,57 +1947,10 @@ function createRenderState$1(resumableState, nonce, importMap) { '"); // Allows us to // if passed externalRuntimeConfig and the enableFizzExternalRuntime feature flag // is set, the server will send instructions via data attributes (instead of inline scripts) -function createRenderState$1(resumableState, nonce, importMap) { +function createRenderState$1( + resumableState, + nonce, + bootstrapScriptContent, + bootstrapScripts, + bootstrapModules, + externalRuntimeConfig, + importMap +) { var inlineScriptWithNonce = nonce === undefined ? startInlineScript @@ -1939,57 +1947,10 @@ function createRenderState$1(resumableState, nonce, importMap) { '"); // Allows us to // if passed externalRuntimeConfig and the enableFizzExternalRuntime feature flag // is set, the server will send instructions via data attributes (instead of inline scripts) -function createRenderState(resumableState, nonce, importMap) { +function createRenderState( + resumableState, + nonce, + bootstrapScriptContent, + bootstrapScripts, + bootstrapModules, + externalRuntimeConfig, + importMap +) { var inlineScriptWithNonce = nonce === undefined ? startInlineScript @@ -1936,57 +1944,10 @@ function createRenderState(resumableState, nonce, importMap) { '