fix(fuselage): `CardGrid` renders empty grid items for null or boolean children · Issue #42804 · RocketChat/Rocket.Chat · GitHub
Skip to content

fix(fuselage): CardGrid renders empty grid items for null or boolean children #42804

Open

Description

@tassoevan

Description

CardGrid wraps each child with Children.map, which also visits null, undefined and boolean children. A conditionally rendered card ({cond && <Card />}) leaves an empty, padded GridItem.

Suggested fix

Map over Children.toArray(children).

Context

Found by cubic while reviewing #42763, which moved @rocket.chat/fuselage into this monorepo. The behavior is unchanged from Fuselage 0.96.0, so it was out of scope there.

Activity

  1. added
    area: ui/uxRelated to UI/UX, frontend code, accessibility, and user interaction
    on Oct 15, 2026
  2. Aviral-Ranjan commented on Oct 16, 2026

    @Aviral-Ranjan

    hi, i would like to work on this.

  3. rohanSSBJ commented on Oct 17, 2026

    @rohanSSBJ

    Hi @tassoevan I noticed that this is a pretty forward issue for a first-time contributor like me, I know the bug hides in mapping through the child components also renders null components introducing unnecessary padding and spacing and the fix could simply be

    Children.toArray(children).map((child) => (
        <GridItem>{child}</GridItem>
      ))
    

    and I can also add regression tests later
    let me know if u can approve me to work on this

  4. added 3 commits that reference this issue on Oct 23, 2026
    7693b19
    d818de4
    c5141d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ui/uxRelated to UI/UX, frontend code, accessibility, and user interactiontype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions