Skip to content

Commit

Permalink
[Flight] Allow a Server Reference to be registered twice (#28343)
Browse files Browse the repository at this point in the history
It's possible for the same function instance to appear more than once in
the same graph or even the same file.

Currently this errors on trying to reconfigure the property but it
really doesn't matter which one wins. First or last.

Regardless there will be an entry point generated that can get them.

DiffTrain build for [9444c51](9444c51)
  • Loading branch information
sebmarkbage committed Feb 19, 2024
1 parent 43967e7 commit 94683ff
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c1fd2a91b1042c137d750be85e5998f699a54d2a
9444c51c7e44936c24e1f44db905cfd45c51cff3
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,4 +610,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-a12e20fd";
exports.version = "18.3.0-www-modern-f4161761";
18 changes: 17 additions & 1 deletion compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-classic-d7b5bc9a";
var ReactVersion = "18.3.0-www-classic-a730f95d";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -171,6 +171,10 @@ if (__DEV__) {
return "[...]";
}

if (value !== null && value.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
}

var name = objectName(value);

if (name === "Object") {
Expand All @@ -181,6 +185,10 @@ if (__DEV__) {
}

case "function":
if (value.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
}

return "function";

default:
Expand Down Expand Up @@ -226,6 +234,12 @@ if (__DEV__) {
return "";
}

var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");

function describeClientReference(ref) {
return "client";
}

function describeObjectForErrorMessage(objectOrArray, expandedName) {
var objKind = objectName(objectOrArray);

Expand Down Expand Up @@ -307,6 +321,8 @@ if (__DEV__) {
} else {
if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) {
str = "<" + describeElementType(objectOrArray.type) + "/>";
} else if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
} else if (jsxPropsParents.has(objectOrArray)) {
// Print JSX
var _type = jsxPropsParents.get(objectOrArray);
Expand Down
18 changes: 17 additions & 1 deletion compiled/facebook-www/ReactDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-modern-4fe256fb";
var ReactVersion = "18.3.0-www-modern-2b72b29d";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -171,6 +171,10 @@ if (__DEV__) {
return "[...]";
}

if (value !== null && value.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
}

var name = objectName(value);

if (name === "Object") {
Expand All @@ -181,6 +185,10 @@ if (__DEV__) {
}

case "function":
if (value.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
}

return "function";

default:
Expand Down Expand Up @@ -226,6 +234,12 @@ if (__DEV__) {
return "";
}

var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");

function describeClientReference(ref) {
return "client";
}

function describeObjectForErrorMessage(objectOrArray, expandedName) {
var objKind = objectName(objectOrArray);

Expand Down Expand Up @@ -307,6 +321,8 @@ if (__DEV__) {
} else {
if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) {
str = "<" + describeElementType(objectOrArray.type) + "/>";
} else if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
} else if (jsxPropsParents.has(objectOrArray)) {
// Print JSX
var _type = jsxPropsParents.get(objectOrArray);
Expand Down
16 changes: 16 additions & 0 deletions compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ if (__DEV__) {
return "[...]";
}

if (value !== null && value.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
}

var name = objectName(value);

if (name === "Object") {
Expand All @@ -179,6 +183,10 @@ if (__DEV__) {
}

case "function":
if (value.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
}

return "function";

default:
Expand Down Expand Up @@ -224,6 +232,12 @@ if (__DEV__) {
return "";
}

var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");

function describeClientReference(ref) {
return "client";
}

function describeObjectForErrorMessage(objectOrArray, expandedName) {
var objKind = objectName(objectOrArray);

Expand Down Expand Up @@ -305,6 +319,8 @@ if (__DEV__) {
} else {
if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) {
str = "<" + describeElementType(objectOrArray.type) + "/>";
} else if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
} else if (jsxPropsParents.has(objectOrArray)) {
// Print JSX
var _type = jsxPropsParents.get(objectOrArray);
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -17085,7 +17085,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1783 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-39d968b9",
version: "18.3.0-www-modern-448aa5e1",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2154 = {
Expand Down Expand Up @@ -17116,7 +17116,7 @@ var internals$jscomp$inline_2154 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-39d968b9"
reconcilerVersion: "18.3.0-www-modern-448aa5e1"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2155 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17537,4 +17537,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "18.3.0-www-modern-39d968b9";
exports.version = "18.3.0-www-modern-448aa5e1";
16 changes: 16 additions & 0 deletions compiled/facebook-www/ReactFlightDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,10 @@ if (__DEV__) {
return "[...]";
}

if (value !== null && value.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
}

var name = objectName(value);

if (name === "Object") {
Expand All @@ -839,6 +843,10 @@ if (__DEV__) {
}

case "function":
if (value.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
}

return "function";

default:
Expand Down Expand Up @@ -884,6 +892,12 @@ if (__DEV__) {
return "";
}

var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");

function describeClientReference(ref) {
return "client";
}

function describeObjectForErrorMessage(objectOrArray, expandedName) {
var objKind = objectName(objectOrArray);

Expand Down Expand Up @@ -965,6 +979,8 @@ if (__DEV__) {
} else {
if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) {
str = "<" + describeElementType(objectOrArray.type) + "/>";
} else if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) {
return describeClientReference();
} else if (jsxPropsParents.has(objectOrArray)) {
// Print JSX
var _type = jsxPropsParents.get(objectOrArray);
Expand Down
6 changes: 5 additions & 1 deletion compiled/facebook-www/ReactFlightDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,12 @@ function describeValueForErrorMessage(value) {
);
case "object":
if (isArrayImpl(value)) return "[...]";
if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
return "client";
value = objectName(value);
return "Object" === value ? "{...}" : value;
case "function":
return "function";
return value.$$typeof === CLIENT_REFERENCE_TAG ? "client" : "function";
default:
return String(value);
}
Expand Down Expand Up @@ -377,6 +379,7 @@ function describeElementType(type) {
}
return "";
}
var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
function describeObjectForErrorMessage(objectOrArray, expandedName) {
var objKind = objectName(objectOrArray);
if ("Object" !== objKind && "Array" !== objKind) return objKind;
Expand All @@ -402,6 +405,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
} else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
str = "<" + describeElementType(objectOrArray.type) + "/>";
else {
if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
str = "{";
i = Object.keys(objectOrArray);
for (value = 0; value < i.length; value++) {
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactTestRenderer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -26067,7 +26067,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-www-modern-5300fd2b";
var ReactVersion = "18.3.0-www-modern-f239ff56";

// Might add PROFILE later.

Expand Down

0 comments on commit 94683ff

Please sign in to comment.