diff --git a/src/runtime/client/reviver.ts b/src/runtime/client/reviver.ts index e03eded8..97a34e27 100644 --- a/src/runtime/client/reviver.ts +++ b/src/runtime/client/reviver.ts @@ -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); diff --git a/tests/islands_test.tsx b/tests/islands_test.tsx index 886869d3..91ae5498 100644 --- a/tests/islands_test.tsx +++ b/tests/islands_test.tsx @@ -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( + + + +
+ +
+
+ +
+ +
+
+
+
, + ); + }); + + 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 () => {