You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fizz] Prevent uncloned large precomputed chunks without relying on render-time assertions (#28568)
A while back we implemented a heuristic that if a chunk was large it was
assumed to be produced by the render and thus was safe to stream which
results in transferring the underlying object memory. Later we ran into
an issue where a precomputed chunk grew large enough to trigger this
hueristic and it started causing renders to fail because once a second
render had occurred the precomputed chunk would not have an underlying
buffer of bytes to send and these bytes would be omitted from the
stream. We implemented a technique to detect large precomputed chunks
and we enforced that these always be cloned before writing.
Unfortunately our test coverage was not perfect and there has been for a
very long time now a usage pattern where if you complete a boundary in
one flush and then complete a boundary that has stylehsheet dependencies
in another flush you can get a large precomputed chunk that was not
being cloned to be sent twice causing streaming errors.
I've thought about why we even went with this solution in the first
place and I think it was a mistake. It relies on a dev only check to
catch paired with potentially version specific order of operations on
the streaming side. This is too unreliable. Additionally the low limit
of view size for Edge is not used in Node.js but there is not real
justification for this.
In this change I updated the view size for edge streaming to match Node
at 2048 bytes which is still relatively small and we have no data one
way or another to preference 512 over this. Then I updated the assertion
logic to error anytime a precomputed chunk exceeds the size. This
eliminates the need to clone these chunks by just making sure our view
size is always larger than the largest precomputed chunk we can possibly
write. I'm generally in favor of this for a few reasons.
First, we'll always know during testing whether we've violated the limit
as long as we exercise each stream config because the precomputed chunks
are created in module scope. Second, we can always split up large chunks
so making sure the precomptued chunk is smaller than whatever view size
we actually desire is relatively trivial.
DiffTrain build for commit b09e102.
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -25454,7 +25454,7 @@ if (__DEV__) {
25454
25454
return root;
25455
25455
}
25456
25456
25457
-
var ReactVersion = "18.3.0-canary-1293047d6-20240315";
25457
+
var ReactVersion = "18.3.0-canary-b09e102ff-20240316";
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9175,7 +9175,7 @@ var devToolsConfig$jscomp$inline_1016 = {
9175
9175
throwError("TestRenderer does not support findFiberByHostInstance()");
9176
9176
},
9177
9177
bundleType: 0,
9178
-
version: "18.3.0-canary-1293047d6-20240315",
9178
+
version: "18.3.0-canary-b09e102ff-20240316",
9179
9179
rendererPackageName: "react-test-renderer"
9180
9180
};
9181
9181
varinternals$jscomp$inline_1194={
@@ -9206,7 +9206,7 @@ var internals$jscomp$inline_1194 = {
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9603,7 +9603,7 @@ var devToolsConfig$jscomp$inline_1058 = {
9603
9603
throwError("TestRenderer does not support findFiberByHostInstance()");
9604
9604
},
9605
9605
bundleType: 0,
9606
-
version: "18.3.0-canary-1293047d6-20240315",
9606
+
version: "18.3.0-canary-b09e102ff-20240316",
9607
9607
rendererPackageName: "react-test-renderer"
9608
9608
};
9609
9609
varinternals$jscomp$inline_1235={
@@ -9634,7 +9634,7 @@ var internals$jscomp$inline_1235 = {
0 commit comments