Skip to content

Commit 71b929e

Browse files
authored
fix(ssr): slightly address slots not at top level (#4997)
slightly break context providers
1 parent 9dbafa8 commit 71b929e

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,17 @@ export const expectedFailures = new Set([
1717
'attribute-namespace/index.js',
1818
'attribute-style/basic/index.js',
1919
'attribute-style/dynamic/index.js',
20-
'dynamic-slots/index.js',
20+
'context-slotted/index.js',
2121
'exports/component-as-default/index.js',
22-
'if-conditional-slot-content/index.js',
2322
'known-boolean-attributes/default-def-html-attributes/static-on-component/index.js',
2423
'render-dynamic-value/index.js',
2524
'scoped-slots/advanced/index.js',
2625
'scoped-slots/expression/index.js',
2726
'scoped-slots/mixed-with-light-dom-slots-inside/index.js',
2827
'scoped-slots/mixed-with-light-dom-slots-outside/index.js',
2928
'slot-forwarding/scoped-slots/index.js',
30-
'slot-not-at-top-level/advanced/ifTrue/shadow/index.js',
3129
'slot-not-at-top-level/advanced/lwcIf/light/index.js',
3230
'slot-not-at-top-level/advanced/lwcIf/shadow/index.js',
33-
'slot-not-at-top-level/ifTrue/shadow/index.js',
3431
'slot-not-at-top-level/lwcIf/light/index.js',
3532
'slot-not-at-top-level/lwcIf/shadow/index.js',
3633
'superclass/render-in-superclass/no-template-in-subclass/index.js',

packages/@lwc/ssr-compiler/src/compile-template/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ const bExportTemplate = esTemplate`
5555
if (!isLightDom) {
5656
yield '</template>';
5757
if (shadowSlottedContent) {
58-
// instance must be passed in; this is used to establish the contextful relationship
59-
// between context provider (aka parent component) and context consumer (aka slotted content)
60-
yield* shadowSlottedContent(instance);
58+
yield* shadowSlottedContent();
6159
}
6260
}
6361
}

packages/@lwc/ssr-compiler/src/compile-template/transformers/component/slotted-content.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ import type { TransformerContext } from '../../types';
3434

3535
const bGenerateSlottedContent = esTemplateWithYield`
3636
const shadowSlottedContent = ${/* hasShadowSlottedContent */ is.literal}
37-
? async function* generateSlottedContent(instance) {
38-
// The 'instance' variable is shadowed here so that a contextful relationship
39-
// is established between components rendered in slotted content & the "parent"
40-
// component that contains the <slot>.
37+
? async function* generateShadowSlottedContent() {
4138
${/* shadow slot content */ is.statement}
4239
}
4340
// Avoid creating the object unnecessarily

0 commit comments

Comments
 (0)