Skip to content

Commit

Permalink
[Flight] Add Support for Map and Set (#26933)
Browse files Browse the repository at this point in the history
We already support these in the sense that they're Iterable so they just
get serialized as arrays. However, these are part of the Structured
Clone algorithm [and should be
supported](#25687).

The encoding is simply the same form as the Iterable, which is
conveniently the same as the constructor argument. The difference is
that now there's a separate reference to it.

It's a bit awkward because for multiple reference to the same value,
it'd be a new Map/Set instance for each reference. So to encode sharing,
it needs one level of indirection with its own ID. That's not really a
big deal for other types since they're inline anyway - but since this
needs to be outlined it creates possibly two ids where there only needs
to be one or zero.

One variant would be to encode this in the row type. Another variant
would be something like what we do for React Elements where they're
arrays but tagged with a symbol. For simplicity I stick with the simple
outlining for now.

DiffTrain build for commit a1c62b8.
  • Loading branch information
sebmarkbage committed Jun 27, 2023
1 parent 45a8655 commit 161c5ae
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 @@ -23991,7 +23991,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-822386f25-20230627";
var ReactVersion = "18.3.0-canary-a1c62b8a7-20230627";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8646,7 +8646,7 @@ var devToolsConfig$jscomp$inline_1036 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-822386f25-20230627",
version: "18.3.0-canary-a1c62b8a7-20230627",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1238 = {
Expand Down Expand Up @@ -8677,7 +8677,7 @@ var internals$jscomp$inline_1238 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-822386f25-20230627"
reconcilerVersion: "18.3.0-canary-a1c62b8a7-20230627"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1239 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9072,7 +9072,7 @@ var devToolsConfig$jscomp$inline_1078 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-822386f25-20230627",
version: "18.3.0-canary-a1c62b8a7-20230627",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1279 = {
Expand Down Expand Up @@ -9103,7 +9103,7 @@ var internals$jscomp$inline_1279 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-822386f25-20230627"
reconcilerVersion: "18.3.0-canary-a1c62b8a7-20230627"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1280 = __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-822386f25-20230627";
var ReactVersion = "18.3.0-canary-a1c62b8a7-20230627";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,4 +623,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-canary-822386f25-20230627";
exports.version = "18.3.0-canary-a1c62b8a7-20230627";
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-canary-822386f25-20230627";
exports.version = "18.3.0-canary-a1c62b8a7-20230627";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
822386f252fd1f0e949efa904a1ed790133329f7
a1c62b8a7635c0bc51e477ba5437df9be5a9e64f

0 comments on commit 161c5ae

Please sign in to comment.