fix(jellyfin): request DateCreated on album hub rows so Date Added sorts work

The Latest Albums see-all sheet offers a Date Added sort, but its rows were
requested without DateCreated, so addedAt mapped null and the sort silently
compared nulls — the same gap the earlier DateCreated work closed for catalog
and hub rows. DateCreated is a direct dto property, not one of the per-row
COUNT fields that motivated this set's slimness (#1552), so the cost profile
of these folder-dto requests is unchanged.
This commit is contained in:
edde746
2026-08-21 19:23:44 +02:00
parent 595a846bb9
commit 24d7681d92
2 changed files with 11 additions and 6 deletions
@@ -137,8 +137,12 @@ const _baseFolderRowFields = 'SortName';
/// count fields are needed; queried with `EnableUserData=false` like the
/// filesystem folder rows. Trade-off: fully played albums lose the watched
/// checkmark on this row (Jellyfin web's latest-albums row shows no play
/// state either).
const _baseMusicAlbumRowFields = 'PremiereDate,OriginalTitle,SortName';
/// state either). `DateCreated` stays in the set despite the slimness goal:
/// it is a direct dto property (no COUNT query), and the Latest Albums
/// see-all sheet offers the "Date Added" sort, whose [MediaItem.recencySortKey]
/// degrades to null-comparing no-ops without it — the same gap #1552's
/// DateCreated work closed for catalog and hub rows.
const _baseMusicAlbumRowFields = 'PremiereDate,OriginalTitle,SortName,DateCreated';
/// Played-track hub rows (Recently Played / Most Played): Audio LEAF dtos.
/// Keeps `UserData` — a cheap direct lookup on leaves that drives the
+5 -4
View File
@@ -3005,13 +3005,13 @@ void main() {
final artistAlbums = captured[2].queryParameters;
final albumTracks = captured[3].queryParameters;
expect(albumBrowse['Fields'], 'PremiereDate,OriginalTitle,SortName');
expect(albumBrowse['Fields'], 'PremiereDate,OriginalTitle,SortName,DateCreated');
expect(albumBrowse['EnableUserData'], 'false');
expect(trackBrowse['Fields'], 'UserData,PremiereDate,OriginalTitle,SortName');
expect(albumBrowse['IncludeItemTypes'], 'MusicAlbum');
expect(trackBrowse['IncludeItemTypes'], 'Audio');
expect(trackBrowse.containsKey('EnableUserData'), isFalse);
expect(artistAlbums['Fields'], 'PremiereDate,OriginalTitle,SortName');
expect(artistAlbums['Fields'], 'PremiereDate,OriginalTitle,SortName,DateCreated');
expect(artistAlbums['EnableUserData'], 'false');
expect(albumTracks['Fields'], 'UserData,PremiereDate,OriginalTitle,SortName');
});
@@ -4391,8 +4391,9 @@ void main() {
expect(captured!.queryParameters['ParentId'], 'lib-99');
expect(captured!.queryParameters['Limit'], '30');
// Album FOLDER dtos: count/user-data fields would each cost the server
// a recursive per-album COUNT query (#1552).
expect(captured!.queryParameters['Fields'], 'PremiereDate,OriginalTitle,SortName');
// a recursive per-album COUNT query (#1552). DateCreated is a direct dto
// property and backs the see-all sheet's "Date Added" sort.
expect(captured!.queryParameters['Fields'], 'PremiereDate,OriginalTitle,SortName,DateCreated');
expect(captured!.queryParameters['EnableUserData'], 'false');
client.close();
});