mirror of
https://github.com/Chevron7Locked/kima-hub.git
synced 2026-06-19 07:37:17 +00:00
d1bc273f00
Prisma's default ASC sort uses Postgres NULLS LAST, so the compound order `[discNumber asc, trackNo asc]` added in PR #170 reorders tracks in mixed-state libraries: any album where some tracks have been rescanned post-migration (getting discNumber) and others have not (staying NULL) ends up with the numbered-disc tracks first and the NULL-disc tracks dumped at the end, breaking the original trackNo order that users expected. Fix: use `{ sort: 'asc', nulls: 'first' }` on discNumber in all six orderBy call sites (library/albums, offline, share, and the three places in subsonic/library). This keeps NULL-disc tracks sorting before disc-1 tracks, preserving pre-migration behavior for all-NULL albums (the common case right after upgrade) and only slightly reordering partially-rescanned multi-disc albums (rare, and only until a full rescan completes). Found during pre-release review.