Skip to content

Tracks: avoid re-sorting table when purging/hiding tracks#15872

Merged
daschuer merged 1 commit intomixxxdj:2.5from
ronso0:tracks-avoid-resorting
Jan 19, 2026
Merged

Tracks: avoid re-sorting table when purging/hiding tracks#15872
daschuer merged 1 commit intomixxxdj:2.5from
ronso0:tracks-avoid-resorting

Conversation

@ronso0
Copy link
Copy Markdown
Member

@ronso0 ronso0 commented Jan 18, 2026

Should fix #12565

Reproduce the issue:

  • go to Tracks, sort by "last played"
  • play some tracks
    -> their "last played" values changes, track order is stable
  • remove (purge) or hide a track, via hotkey, deck or table track menu
    -> table is resorted by "last played" :| sometimes also the selected index is lost

After purge/hide BaseSqlTableModel::select() is called, which rebuilds the model cache with with new values from the db. This implies re-sorting.

The fix:

Based on the assumption that metadata of the tracks remaning after purge/hide is unchanged, we don't need to call select() -- we can simply remove the obsolete rows.
This does however not apply to Playlists where removing tracks changes the 'position' value of the others. There we still select() for now.

Note: so far I only tested with Tracks.
Also test with the Crates and Hidden views.

@ronso0 ronso0 linked an issue Jan 18, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is reasonable.
This works for hiding, but now for delete form crates. Can you add it there as well?

Comment thread src/library/basesqltablemodel.cpp Outdated
Comment thread src/library/basesqltablemodel.cpp Outdated
Implemented for track models that don't have a position column (playlists)
as that still requires rebuilding the row cache
@ronso0 ronso0 force-pushed the tracks-avoid-resorting branch from 67a7e2a to 1379c77 Compare January 18, 2026 09:38
@ronso0
Copy link
Copy Markdown
Member Author

ronso0 commented Jan 18, 2026

I also implemented it for crates and removed the debug stuff.

Copy link
Copy Markdown
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and works nice. Thank you.

@daschuer daschuer merged commit 2f65506 into mixxxdj:2.5 Jan 19, 2026
13 checks passed
@acolombier acolombier added this to the 2.5.5 milestone Feb 25, 2026
@github-project-automation github-project-automation Bot moved this to In progress in Releases Feb 25, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in Releases Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Tracks are resorted after track removal

3 participants