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.
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
[labs/react] Add Node build #3410
[labs/react] Add Node build #3410
Changes from all commits
e48176a
1577bb4
fe450aa
b67c03a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I feel like this ternary should be able to be done at the
module
level.There should be a way to get the
prototype
orfalse
outside of theReactComponent.render
function and outside of thecreateComponent
function?then later we can use the appropriate prototype instead of both?
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.
The ternary is potentially run for every property on every render. It should be only called when necessary.
Also the following in-out check disappears in #3128
So this check might not conflict with the current code, but it does not fit in the proposed changes of #3128 which corrects the behavior these changes are based on.
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.
The location of the code doesn't matter since terser will remove the side of the ternary that doesn't belong based on
NODE_MODE
for the "node" and "production" builds. I think it's cleanest if the conditional is close to whereHTMLElement
is referenced so we can remove it for the node build.(this part was based on your first comment pre-edit.)element
andHTMLElement
are not the interchangeable part here.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.
Regarding #3128, see #3410 (comment)
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.
I understand the need for it to be close to the logic. But it's too much happening in an
if
statement. It makes it more difficult to read and maintain later on. Accounting for a fallback at the module level is more durable. This is technically a nested if statement except it's nested at the condition statement.We are
if
-ing a prototype and a ternary inside a conditional statement does not read that way to meThere 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.
HTMLElement
is not used in #3128, this is what i mean byconflicts
. Not conflicts as in git i mean conflicts as in implementation and correctnessThere 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.
Was lurking and not very plugged into this, but was reading the source on the branch and this line of code stood out to me.
Agree with Brian on this one. If you're keeping this logic, is there a way to rewrite this without hurting perf? Nested
if
I think would be okay here if only for readabilityThere 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.
Yup. Now with the reference to
HTMLElement
moved to a lifecycle that won't be called on the server, this gnarly condition here won't be necessary. To address prop/attribute handling during server-render, I anticipate it'll be a much more straight forward singleif (NODE_MODE)
orif (isServer)
check instead.