Skip to content

Commit

Permalink
Remove obsolete name property in Flight Node Register
Browse files Browse the repository at this point in the history
This is a leftover from #26300 where `name` was incorporated into `$$id`.
  • Loading branch information
unstubbable committed Mar 6, 2023
1 parent eb616a1 commit 96b9eef
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module.exports = function register() {

const deepProxyHandlers = {
get: function (target: Function, name: string, receiver: Proxy<Function>) {
const [, targetName] = target.$$id.split('#');

switch (name) {
// These names are read by the Flight runtime if you end up using the exports object.
case '$$typeof':
Expand All @@ -48,7 +50,7 @@ module.exports = function register() {
case '$$async':
return target.$$async;
case 'name':
return target.name;
return targetName;
case 'displayName':
return undefined;
// We need to special case this because createElement reads it if we pass this
Expand All @@ -69,7 +71,7 @@ module.exports = function register() {
);
}
// eslint-disable-next-line react-internal/safe-string-coercion
const expression = String(target.name) + '.' + String(name);
const expression = String(targetName) + '.' + String(name);
throw new Error(
`Cannot access ${expression} on the server. ` +
'You cannot dot into a client module from a server component. ' +
Expand All @@ -95,8 +97,6 @@ module.exports = function register() {
return target.$$id;
case '$$async':
return target.$$async;
case 'name':
return target.name;
// We need to special case this because createElement reads it if we pass this
// reference.
case 'defaultProps':
Expand Down Expand Up @@ -185,7 +185,6 @@ module.exports = function register() {
);
}: any),
{
name: {value: name},
$$typeof: {value: CLIENT_REFERENCE},
$$id: {value: target.$$id + '#' + name},
$$async: {value: target.$$async},
Expand Down

0 comments on commit 96b9eef

Please sign in to comment.