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 [49eba01](49eba01)
  • Loading branch information
gnoff committed Sep 26, 2023
1 parent 6471d10 commit 60367bc
Show file tree
Hide file tree
Showing 9 changed files with 3,705 additions and 3,177 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bff6be8eb1d77980c13f3e01be63cb813a377058
49eba01930e9e1f331b34967fca65d5a0ba62846
Loading

0 comments on commit 60367bc

Please sign in to comment.