-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove obsolete name
property from client reference in Flight Node Register
#26322
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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': | ||
|
@@ -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 | ||
|
@@ -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. ' + | ||
|
@@ -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': | ||
|
@@ -185,7 +185,6 @@ module.exports = function register() { | |
); | ||
}: any), | ||
{ | ||
name: {value: name}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this was left in intentionally for convenience (i.e. reading it in |
||
$$typeof: {value: CLIENT_REFERENCE}, | ||
$$id: {value: target.$$id + '#' + name}, | ||
$$async: {value: target.$$async}, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case was not covered by a unit test, but I think it's dead code and can not be reached.