Conversation
ealipkin
commented
Nov 10, 2025
- fix(datatable): preserve keyless columns during reorder
- Resolves #6764 and #5633
- Scope: DataTable reorderable-columns logic only
- Root cause: columns() rebuilt the ordered list purely from d_columnOrder. findColumnByKey treated null order entries as a match for the first column with a falsy key, so selector or frozen columns were duplicated when d_columnOrder contained null placeholders. The final spread (...cols.filter) then re-appended the original keyed column, causing copies to appear after each drag. The same logic also forced keyless columns to the tail of the array when null was used to reserve their position.
- Fix: tightened findColumnByKey to ignore null or undefined props and process d_columnOrder with a queue of keyless columns so each null placeholder consumes exactly one selector or frozen column in its original sequence. Hidden columns remain skipped and the remainder filter no longer re-adds duplicates.
- Verification: manual testing with selector plus multi reorder, frozen action column, and multiple null placeholders at the start and end of d_columnOrder. Column count stays stable, keyless columns remain anchored, and hidden columns are still excluded.
…mns during reorder
Coderxrohan
approved these changes
Jan 4, 2026
Coderxrohan
left a comment
There was a problem hiding this comment.
This is a really solid fix — thanks for the detailed explanation as well.
I’ve dealt with this exact edge case in PrimeVue DataTable before, and your root cause analysis around d_columnOrder + null placeholders matches what I’ve seen in practice. Tightening findColumnByKey to ignore null / undefined keys and then consuming keyless columns via a queue feels like the right approach.
I also like that:
- Keyless (selector / action / frozen) columns stay anchored
- Hidden columns remain excluded
- Duplicate columns are no longer re-appended after reorder
The change is nicely scoped to reorderable-columns logic and doesn’t affect normal keyed columns. From a quick review, I don’t see any behavioral regressions, and the verification scenarios you listed cover the risky cases.
From my side, this looks safe to merge and a good fix for a long-standing issue
This branch has not been deployed
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.