Skip to content

Commit 61a5c5b

Browse files
committed
[Flight] Add Serialization of Typed Arrays / ArrayBuffer / DataView (#26954)
This uses the same mechanism as [large strings](#26932) to encode chunks of length based binary data in the RSC payload behind a flag. I introduce a new BinaryChunk type that's specific to each stream and ways to convert into it. That's because we sometimes need all chunks to be Uint8Array for the output, even if the source is another array buffer view, and sometimes we need to clone it before transferring. Each type of typed array is its own row tag. This lets us ensure that the instance is directly in the right format in the cached entry instead of creating a wrapper at each reference. Ideally this is also how Map/Set should work but those are lazy which complicates that approach a bit. We assume both server and client use little-endian for now. If we want to support other modes, we'd convert it to/from little-endian so that the transfer protocol is always little-endian. That way the common clients can be the fastest possible. So far this only implements Server to Client. Still need to implement Client to Server for parity. NOTE: This is the first time we make RSC effectively a binary format. This is not compatible with existing SSR techniques which serialize the stream as unicode in the HTML. To be compatible, those implementations would have to use base64 or something like that. Which is what we'll do when we move this technique to be built-in to Fizz. DiffTrain build for commit d9c3331.
1 parent 8086b98 commit 61a5c5b

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23991,7 +23991,7 @@ function createFiberRoot(
2399123991
return root;
2399223992
}
2399323993

23994-
var ReactVersion = "18.3.0-canary-2153a2966-20230628";
23994+
var ReactVersion = "18.3.0-canary-d9c333199-20230629";
2399523995

2399623996
// Might add PROFILE later.
2399723997

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8646,7 +8646,7 @@ var devToolsConfig$jscomp$inline_1036 = {
86468646
throw Error("TestRenderer does not support findFiberByHostInstance()");
86478647
},
86488648
bundleType: 0,
8649-
version: "18.3.0-canary-2153a2966-20230628",
8649+
version: "18.3.0-canary-d9c333199-20230629",
86508650
rendererPackageName: "react-test-renderer"
86518651
};
86528652
var internals$jscomp$inline_1238 = {
@@ -8677,7 +8677,7 @@ var internals$jscomp$inline_1238 = {
86778677
scheduleRoot: null,
86788678
setRefreshHandler: null,
86798679
getCurrentFiber: null,
8680-
reconcilerVersion: "18.3.0-canary-2153a2966-20230628"
8680+
reconcilerVersion: "18.3.0-canary-d9c333199-20230629"
86818681
};
86828682
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
86838683
var hook$jscomp$inline_1239 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9072,7 +9072,7 @@ var devToolsConfig$jscomp$inline_1078 = {
90729072
throw Error("TestRenderer does not support findFiberByHostInstance()");
90739073
},
90749074
bundleType: 0,
9075-
version: "18.3.0-canary-2153a2966-20230628",
9075+
version: "18.3.0-canary-d9c333199-20230629",
90769076
rendererPackageName: "react-test-renderer"
90779077
};
90789078
var internals$jscomp$inline_1279 = {
@@ -9103,7 +9103,7 @@ var internals$jscomp$inline_1279 = {
91039103
scheduleRoot: null,
91049104
setRefreshHandler: null,
91059105
getCurrentFiber: null,
9106-
reconcilerVersion: "18.3.0-canary-2153a2966-20230628"
9106+
reconcilerVersion: "18.3.0-canary-d9c333199-20230629"
91079107
};
91089108
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
91099109
var hook$jscomp$inline_1280 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-canary-2153a2966-20230628";
30+
var ReactVersion = "18.3.0-canary-d9c333199-20230629";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,4 +623,4 @@ exports.useSyncExternalStore = function (
623623
);
624624
};
625625
exports.useTransition = useTransition;
626-
exports.version = "18.3.0-canary-2153a2966-20230628";
626+
exports.version = "18.3.0-canary-d9c333199-20230629";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ exports.useSyncExternalStore = function (
626626
);
627627
};
628628
exports.useTransition = useTransition;
629-
exports.version = "18.3.0-canary-2153a2966-20230628";
629+
exports.version = "18.3.0-canary-d9c333199-20230629";
630630

631631
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
632632
if (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2153a29661e5998604225f81d93c8a20a1934adf
1+
d9c333199ed19798484e49eef992735321c32cb9

0 commit comments

Comments
 (0)