Skip to content

fix(data-table): avoid spurious expand column on page change#525

Merged
kelsos merged 1 commit intorotki:mainfrom
kelsos:fix/datatable-expand-on-pagination
Apr 28, 2026
Merged

fix(data-table): avoid spurious expand column on page change#525
kelsos merged 1 commit intorotki:mainfrom
kelsos:fix/datatable-expand-on-pagination

Conversation

@kelsos
Copy link
Copy Markdown
Member

@kelsos kelsos commented Apr 28, 2026

Summary

  • RuiDataTable's onPaginate unconditionally ran set(expanded, []) on every page change. For consumers that hadn't bound v-model:expanded, this wrote into useModel's local cache and flipped expandable (!!get(expanded)) to true, causing useTableColumns to auto-append a non-functional expand column (chevron with no expanded-item slot to render).
  • Guarded the reset with if (get(expanded)) so consumers that opt out of expansion are unaffected; consumers that opt in still get pagination resetting their expanded rows.

Test plan

  • Unit: new RuiDataTable.spec.ts test "should not emit update:expanded on page change when expanded is not bound" — emits update:modelValue on the inner RuiTablePagination and asserts no update:expanded fired and no [data-id="expand-button"] appears. Verified to fail without the fix.
  • E2E: new data-table.spec.ts test "should not introduce an expand-button column on page change when expanded is not bound" — paginates the basic table and asserts zero expand buttons. Verified to fail without the fix.
  • Existing 96 RuiDataTable.spec.ts unit tests still pass.

`onPaginate` unconditionally called `set(expanded, [])` on every page
change. When a consumer hadn't bound `v-model:expanded`, this wrote into
`useModel`'s local cache, flipping `expandable` (`!!get(expanded)`) to
true and causing `useTableColumns` to auto-append a non-functional
expand column with no `expanded-item` slot to render.

Guard the reset so it only runs when `expanded` is actually in use.
@kelsos kelsos requested a review from a team as a code owner April 28, 2026 16:18
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.80%. Comparing base (39a3e9f) to head (61b6d4c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #525   +/-   ##
=======================================
  Coverage   84.80%   84.80%           
=======================================
  Files         145      145           
  Lines        5259     5260    +1     
  Branches     1570     1571    +1     
=======================================
+ Hits         4460     4461    +1     
  Misses        799      799           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kelsos kelsos merged commit 61b6d4c into rotki:main Apr 28, 2026
5 checks passed
@kelsos kelsos deleted the fix/datatable-expand-on-pagination branch April 28, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants