Skip to content

🐛 Table: DynamicCellSlots type uses keyof T but slot name uses column.id #5120

@demershov

Description

@demershov

Environment

  • Operating System: Linux
  • Node Version: v22.14.0
  • Nuxt Version: 4.0.3
  • CLI Version: 3.27.0
  • Nitro Version: 2.12.4
  • Package Manager: pnpm@10.17.1
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Vue

Package

v4.x

Version

v4.0.0

Reproduction

The bug is present in the current version of Nuxt UI Table implementation. See code:

  • File: src/runtime/components/Table.vue

Type Declaration Example

// Current implementation:
type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>

Slot Usage Example

<slot :name="`${cell.column.id}-cell`" v-bind="cell.getContext()">
  <FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
</slot>

Description

The type for dynamic cell slots uses keyof T (keys of table data) to generate slot names, but in runtime the slot names are generated from column.id (which may differ from data keys, especially for computed or custom columns).

This mismatch leads to incorrect slot types and makes it difficult to use named slots for columns with ids different from the data keys.

Why is this a bug?

  • Column ids (column.id) can be arbitrary and don't have to match data keys (keyof T).
  • Slot names in the template rely on column.id, not on data keys.
  • This creates confusion and incorrect slot typing, especially for advanced tables with computed columns, nested columns, or custom ids.

Similar issue exists for DynamicHeaderSlots and DynamicFooterSlots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageAwaiting initial review and prioritizationv4#4488

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions