Skip to content

Commit ba24671

Browse files
Fix <component> tag helpers being siblings. Fixes #17851 (#17910)
1 parent 995781c commit ba24671

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/dist/Release/blazor.webassembly.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/src/Rendering/LogicalElements.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ export function toLogicalRootCommentElement(start: Comment, end: Comment): Logic
5454
const parentLogicalElement = toLogicalElement(parent, /* allow existing contents */ true);
5555
const children = getLogicalChildrenArray(parentLogicalElement);
5656
Array.from(parent.childNodes).forEach(n => children.push(n as unknown as LogicalElement));
57+
5758
start[logicalParentPropname] = parentLogicalElement;
5859
// We might not have an end comment in the case of non-prerendered components.
5960
if (end) {
6061
start[logicalEndSiblingPropname] = end;
61-
toLogicalElement(end, /* allowExistingcontents */ true);
62+
toLogicalElement(end);
6263
}
63-
return toLogicalElement(start, /* allowExistingContents */ true);
64+
return toLogicalElement(start);
6465
}
6566

6667
export function toLogicalElement(element: Node, allowExistingContents?: boolean): LogicalElement {
@@ -71,7 +72,10 @@ export function toLogicalElement(element: Node, allowExistingContents?: boolean)
7172
throw new Error('New logical elements must start empty, or allowExistingContents must be true');
7273
}
7374

74-
element[logicalChildrenPropname] = [];
75+
if (!(logicalChildrenPropname in element)) { // If it's already a logical element, leave it alone
76+
element[logicalChildrenPropname] = [];
77+
}
78+
7579
return element as unknown as LogicalElement;
7680
}
7781

0 commit comments

Comments
 (0)