fix(data-table): avoid spurious expand column on page change#525
Merged
kelsos merged 1 commit intorotki:mainfrom Apr 28, 2026
Merged
fix(data-table): avoid spurious expand column on page change#525kelsos merged 1 commit intorotki:mainfrom
kelsos merged 1 commit intorotki:mainfrom
Conversation
`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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RuiDataTable'sonPaginateunconditionally ranset(expanded, [])on every page change. For consumers that hadn't boundv-model:expanded, this wrote intouseModel's local cache and flippedexpandable(!!get(expanded)) totrue, causinguseTableColumnsto auto-append a non-functional expand column (chevron with noexpanded-itemslot to render).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
RuiDataTable.spec.tstest "should not emit update:expanded on page change when expanded is not bound" — emitsupdate:modelValueon the innerRuiTablePaginationand asserts noupdate:expandedfired and no[data-id="expand-button"]appears. Verified to fail without the fix.data-table.spec.tstest "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.RuiDataTable.spec.tsunit tests still pass.