nuxt / nuxt/ui

UTable expand issue - row id alias necessary

Open
#6,327 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
6.9k
Forks
1.1k
Avg merge
1d 7h
Merged PRs (30d)
57

Description

Package

v4.x

Description

Hello, I'm currently using a UTable with expandable rows, and it works great so far.
However, if I expand the first row and then remove the first item from the data source, the first row remains expanded.

How can I ensure that the expanded state stays linked to the correct item?
I was looking for something like a row-key or row-id to provide a stable unique identifier, but it seems UTable doesn’t offer this out of the box.

My current code looks like this

    <UTable
      :sorting="sorting"
      :columns="columns"
      :data="getData"
      class="expandable"
      :loading="isLoading"
      :table-loader="isLoading"
      @select="(event, row) => row.toggleExpanded()"
    >
      <template #expanded="{ row }">
           expanded content
      </template>
    </UTable>

const getData = ref(
  [
  {title: 'one'},
  {title: 'two'}
  ]
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the UTable entry point and inspect how expandable-row state is associated with rows when the data array changes. Reproduce the case by expanding the first row, removing it from the data, and checking that the same item—not the new first row—remains expanded; done means a stable row identifier can preserve that association.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.