Skip to content
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

fix(ssr): fix adjacent text node concatenation #4974

Merged
merged 13 commits into from
Dec 2, 2024
Merged

Conversation

nolanlawson
Copy link
Collaborator

Details

Fixes #4973

Does this pull request introduce a breaking change?

  • 😮‍💨 No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • 🤞 No, it does not introduce an observable change.

@nolanlawson nolanlawson requested a review from a team as a code owner November 27, 2024 21:39
@nolanlawson
Copy link
Collaborator Author

There is apparently some kind of concurrency issue... maybe we want to pull out the buffer variable so it's not shared. I'll take a stab at it.

@@ -34,6 +29,7 @@ export const expectedFailures = new Set([
'scoped-slots/mixed-with-light-dom-slots-inside/index.js',
'scoped-slots/mixed-with-light-dom-slots-outside/index.js',
'slot-forwarding/scoped-slots/index.js',
'slot-not-at-top-level/advanced/ifTrue/light/index.js',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjhsf @jhefferman-sfdc I ended up having to do some big refactoring to avoid shared state in text node concatenation: f7a1e07

This led to a new test failure here because the cxt.nextSibling is actually wrong. This is something unrelated to this PR that we should fix independently. I can open a separate issue for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it looks like only adjacent text concatenation relies on cxt.nextSibling. 😆

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrote a minimal repro... let's deal with it later: 7161ea4

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed that, wrote a better minimal repro... time to stop for real now 😛 34c5e04

Comment on lines +23 to +24
didBufferTextContent = true;
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
didBufferTextContent = true;
{
{
didBufferTextContent = true;

In the context of this helper, seems weird to have that outside of the block statement. But in the context of the generated code, I guess it's more weird to have more code than necessary inside our wonky blocks. So I guess the way you wrote it is better.

Thanks for coming to my TED talk.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will probably end up refactoring this later anyway. If you look at the generated code, there is a ton of duplication, and Rollup does not inline the blocks as much as I'd like. We may end up just going back to the system of autogenerated variable names for performance reasons.

textContentBuffer = '';
didBufferTextContent = false;
}
`<EsBlockStatement>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it really matters, but would IfStatement or whatever be more accurate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! 845edd6

@nolanlawson nolanlawson enabled auto-merge (squash) December 2, 2024 17:52
@nolanlawson nolanlawson merged commit 19b11e4 into master Dec 2, 2024
11 checks passed
@nolanlawson nolanlawson deleted the mob/fix-text-concat branch December 2, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SSR] Fix text concatenation
3 participants