-
Notifications
You must be signed in to change notification settings - Fork 401
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
Conversation
}); | ||
const slotContent = irToEs(clone, cxt); | ||
results.push(b.expressionStatement(bAddLightContent(slotName, null, slotContent))); | ||
}; |
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 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 |
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.
Might be helpful to include a mini example in this explanation.
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.
packages/@lwc/ssr-compiler/src/compile-template/transformers/component/slotted-content.ts
Outdated
Show resolved
Hide resolved
packages/@lwc/ssr-compiler/src/compile-template/transformers/component/slotted-content.ts
Outdated
Show resolved
Hide resolved
…omponent/slotted-content.ts Co-authored-by: Will Harney <[email protected]>
…omponent/slotted-content.ts Co-authored-by: Will Harney <[email protected]>
Details
This fixes some bugs with light DOM slots not at the top level, but only for
if:true
. The problem withlwc: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?
Does this pull request introduce an observable change?