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): non-top-level light slots with if:true #4967

Merged
merged 8 commits into from
Nov 27, 2024

Conversation

nolanlawson
Copy link
Collaborator

Details

This fixes some bugs with light DOM slots not at the top level, but only for if:true. The problem with lwc:if is that it requires generating HTML comment bookends conditionally, which needs more work to finish.

This PR is a modest fix to problems with non-top-level slots, but it's a start.

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 01:09
});
const slotContent = irToEs(clone, cxt);
results.push(b.expressionStatement(bAddLightContent(slotName, null, slotContent)));
};
Copy link
Collaborator Author

@nolanlawson nolanlawson Nov 27, 2024

Choose a reason for hiding this comment

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

This logic is a bit hard to read, and the types are abysmal, but I thought I'd put the PR up anyway and fix it later. Now you know how my twisted mind works. 😆

@@ -62,6 +73,84 @@ const bAddLightContent = esTemplate`
});
`<EsCallExpression>;

// Light DOM slots are a bit complex because of needing to handle slots _not_ at the top level
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be helpful to include a mini example in this explanation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nolanlawson nolanlawson merged commit 15297aa into master Nov 27, 2024
11 checks passed
@nolanlawson nolanlawson deleted the nolan/slots-not-at-top-level branch November 27, 2024 17:56
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.

2 participants