Skip to content

Commit

Permalink
[Fizz][Float] Refactor Resources (#27400)
Browse files Browse the repository at this point in the history
Refactors Resources to have a more compact and memory efficient
struture. Resources generally are just an Array of chunks. A resource is
flushed when it's chunks is length zero. A resource does not have any
other state.

Stylesheets and Style tags are different and have been modeled as a unit
as a StyleQueue. This object stores the style rules to flush as part of
style tags using precedence as well as all the stylesheets associated
with the precedence. Stylesheets still need to track state because it
affects how we issue boundary completion instructions. Additionally
stylesheets encode chunks lazily because we may never write them as html
if they are discovered late.

The preload props transfer is now maximally compact (only stores the
props we would ever actually adopt) and only stores props for
stylesheets and scripts because other preloads have no resource
counterpart to adopt props into. The ResumableState maps that track
which keys have been observed are being overloaded. Previously if a key
was found it meant that a resource already exists (either in this render
or in a prior prerender). Now we discriminate between null and object
values. If map value is null we can assume the resource exists but if it
is an object that represents a prior preload for that resource and the
resource must still be constructed.

DiffTrain build for commit 49eba01.
  • Loading branch information
gnoff committed Sep 26, 2023
1 parent 10ae24a commit 4c54509
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23985,7 +23985,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-bff6be8eb-20230925";
var ReactVersion = "18.3.0-canary-49eba0193-20230926";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8620,7 +8620,7 @@ var devToolsConfig$jscomp$inline_1027 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-bff6be8eb-20230925",
version: "18.3.0-canary-49eba0193-20230926",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1226 = {
Expand Down Expand Up @@ -8651,7 +8651,7 @@ var internals$jscomp$inline_1226 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-bff6be8eb-20230925"
reconcilerVersion: "18.3.0-canary-49eba0193-20230926"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9046,7 +9046,7 @@ var devToolsConfig$jscomp$inline_1069 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-bff6be8eb-20230925",
version: "18.3.0-canary-49eba0193-20230926",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1267 = {
Expand Down Expand Up @@ -9077,7 +9077,7 @@ var internals$jscomp$inline_1267 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-bff6be8eb-20230925"
reconcilerVersion: "18.3.0-canary-49eba0193-20230926"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-bff6be8eb-20230925";
var ReactVersion = "18.3.0-canary-49eba0193-20230926";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-bff6be8eb-20230925";
exports.version = "18.3.0-canary-49eba0193-20230926";
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-bff6be8eb-20230925";
exports.version = "18.3.0-canary-49eba0193-20230926";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bff6be8eb1d77980c13f3e01be63cb813a377058
49eba01930e9e1f331b34967fca65d5a0ba62846

0 comments on commit 4c54509

Please sign in to comment.