From cae0d1b52f556da40c73283abef9281ee2fb292a Mon Sep 17 00:00:00 2001 From: gnoff Date: Mon, 1 May 2023 17:55:35 +0000 Subject: [PATCH] [Fizz] Encode external fizz runtime into chunks eagerly (#26752) in https://github.com/facebook/react/pull/26738 we added nonce to the ResponseState. Initially it was used in a variety of places but the version that got merged only included it with the external fizz runtime. This PR updates the config for the external fizz runtime so that the nonce is encoded into the script chunks at request creation time. The rationale is that for live-requests, streaming is more likely than not so doing the encoding work at the start is better than during flush. For cases such as SSG where the runtime is not required the extra encoding is tolerable (not a live request). Bots are an interesting case because if you want fastest TTFB you will end up requiring the runtime but if you are withholding until the stream is done you have already sacrificed fastest TTFB and the marginal slowdown of the extraneous encoding is hopefully neglibible I'm writing this so later if we learn that this tradeoff isn't worth it we at least understand why I made the change in the first place. DiffTrain build for [8ea96ef84d8f08ed1846dec9e8ed20d2225db0d3](https://github.com/facebook/react/commit/8ea96ef84d8f08ed1846dec9e8ed20d2225db0d3) --- compiled/facebook-www/REVISION | 2 +- .../ReactDOMServer-dev.classic.js | 58 ++++++++------- .../facebook-www/ReactDOMServer-dev.modern.js | 58 ++++++++------- .../ReactDOMServer-prod.classic.js | 72 +++++++++--------- .../ReactDOMServer-prod.modern.js | 72 +++++++++--------- .../ReactDOMServerStreaming-dev.modern.js | 53 ++++++++------ .../ReactDOMServerStreaming-prod.modern.js | 73 ++++++++++--------- 7 files changed, 213 insertions(+), 175 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index ea6b8f667c..d0972ff0c5 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -491aec5d6113ce5bae7c10966bc38a4a8fc091a8 +8ea96ef84d8f08ed1846dec9e8ed20d2225db0d3 diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 48648a69ab..9289241911 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-cc24eed6"; +var ReactVersion = "18.3.0-www-classic-fcee71d2"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -2415,7 +2415,7 @@ function createResponseState$1( '