Skip to content

[🐞] Recursive composition of components lacks named Slot projection. #4922

Open
@genki

Description

@genki

Which component is affected?

Qwik Runtime

Describe the bug

I am trying to compose components recursively like this:

import { component$, Slot } from '@builder.io/qwik';

const Foo = component$(() => {
  return (
    <div>
      <h1>
        <Slot />
      </h1>
      <p>
        <Slot name="foo" />
      </p>
    </div>
  )
})

const Bar = component$(() => {
  return (
  <>
    Hello,
    <p q:slot="foo">Bar</p>
  </>
  )
})

export default component$(() => {
  const comps = [Bar, Foo];
  let c = null;
  for(const cmp of comps) {
    const Cmp = cmp;
    c = <Cmp>{c}</Cmp>;
  }
  return c;
});

The result is success for <Slot /> but fail for <Slot name="foo" />.
The q:slot="foo" is not projected but entire component is projected to <Slot />

Reproduction

https://stackblitz.com/edit/qwik-starter-2us27r?file=src%2Froutes%2Findex.tsx

Steps to reproduce

No response

System Info

System:
    OS: macOS 13.4.1
    CPU: (8) arm64 Apple M2
    Memory: 95.38 MB / 24.00 GB
    Shell: 3.6.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.5.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.8.1 - /opt/homebrew/bin/npm
    pnpm: 8.6.11 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 115.0.5790.170
    Safari: 16.5.2
  npmPackages:
    @builder.io/partytown: ^0.8.0 => 0.8.0
    undici: 5.22.1 => 5.22.1
    vite: 4.4.7 => 4.4.7

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    TYPE: bugSomething isn't workingWAITING FOR: teamWaiting for one of the core team members to review and reply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions