fix: nested children slots erroring (#2674)
Fixes https://github.com/denoland/fresh/issues/2624
This commit is contained in:
@@ -408,11 +408,7 @@ export function domToVNode(
|
||||
});
|
||||
|
||||
const parentVNode = vnodeStack.at(-1)!;
|
||||
if (slotName === "children") {
|
||||
addVNodeChild(parentVNode, vnode);
|
||||
} else {
|
||||
parentVNode.props[slotName] = vnode;
|
||||
}
|
||||
parentVNode.props[slotName] = vnode;
|
||||
vnodeStack.push(vnode);
|
||||
} else if (kind === "partial") {
|
||||
sib = maybeHideMarker(sib);
|
||||
|
||||
@@ -396,6 +396,50 @@ Deno.test({
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "islands - nested children slots",
|
||||
fn: async () => {
|
||||
const passThrough = getIsland("PassThrough.tsx");
|
||||
const selfCounter = getIsland("SelfCounter.tsx");
|
||||
|
||||
const app = testApp()
|
||||
.use(staticFiles())
|
||||
.island(passThrough, "PassThrough", PassThrough)
|
||||
.island(selfCounter, "SelfCounter", SelfCounter)
|
||||
.get("/", (ctx) => {
|
||||
return ctx.render(
|
||||
<Doc>
|
||||
<PassThrough>
|
||||
<PassThrough>
|
||||
<div>
|
||||
<SelfCounter id="a" />
|
||||
</div>
|
||||
</PassThrough>
|
||||
<PassThrough>
|
||||
<div>
|
||||
<SelfCounter id="b" />
|
||||
</div>
|
||||
</PassThrough>
|
||||
</PassThrough>
|
||||
</Doc>,
|
||||
);
|
||||
});
|
||||
|
||||
await withBrowserApp(app, async (page, address) => {
|
||||
await page.goto(address, { waitUntil: "load" });
|
||||
await page.locator(".ready").wait();
|
||||
|
||||
await page.locator("#a .increment").click();
|
||||
await page.locator("#b .increment").click();
|
||||
|
||||
await waitForText(page, "#a .output", "1");
|
||||
await waitForText(page, "#b .output", "1");
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "islands - conditional jsx children",
|
||||
fn: async () => {
|
||||
|
||||
Reference in New Issue
Block a user