-
Notifications
You must be signed in to change notification settings - Fork 48.3k
Adjacent text nodes in SSR should have comments between them despite components #11109
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
This ensures we don't reset it when we exit components that return strings.
This fixes the {'a'}</div>{'b'} case and prevents an unnecessary comment before 'b'.
Deploy preview ready! Built with commit cd2df6c |
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.
lgtm. thank you!
@@ -827,6 +830,7 @@ class ReactDOMServerRenderer { | |||
frame.debugElementStack = []; | |||
} | |||
this.stack.push(frame); | |||
this.previousWasTextNode = false; |
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.
So is this unnecessary now? Seems like the fix was the second commit, not this, no?
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.
If I remember it right I tried commenting both places out separately after adding the tests, and both were necessary. This one resets when we're entering a tag, and another resets when we're leaving a tag.
This fixes #10598.
See individual commits and test cases I added.