fix: avoid /Latest endpoint to improve performance

This commit is contained in:
Gabe Farrell 2025-11-12 18:06:50 -05:00
parent fdb3178f49
commit afe8454359
2 changed files with 8 additions and 4 deletions

View file

@ -161,17 +161,17 @@ class LibraryScreen extends _$LibraryScreen {
]; ];
} }
final latest = await api.usersUserIdItemsLatestGet( final latest = await api.usersUserIdItemsGet(
parentId: viewModel.id, parentId: viewModel.id,
limit: 9, sortBy: [ItemSortBy.datelastcontentadded, ItemSortBy.datecreated, ItemSortBy.sortname],
imageTypeLimit: 1, sortOrder: [SortOrder.descending],
includeItemTypes: viewModel.collectionType.itemKinds.map((e) => e.dtoKind).toList(), includeItemTypes: viewModel.collectionType.itemKinds.map((e) => e.dtoKind).toList(),
); );
newRecommendations = [ newRecommendations = [
...newRecommendations, ...newRecommendations,
RecommendedModel( RecommendedModel(
name: const Latest(), name: const Latest(),
posters: latest.body?.map((e) => ItemBaseModel.fromBaseDto(e, ref)).toList() ?? [], posters: latest.body?.items?.map((e) => ItemBaseModel.fromBaseDto(e, ref)).toList() ?? [],
type: null, type: null,
), ),
]; ];

View file

@ -698,6 +698,8 @@ class JellyService {
Future<Response<BaseItemDtoQueryResult>> usersUserIdItemsGet({ Future<Response<BaseItemDtoQueryResult>> usersUserIdItemsGet({
String? parentId, String? parentId,
List<ItemSortBy>? sortBy,
List<SortOrder>? sortOrder,
bool? recursive, bool? recursive,
List<BaseItemKind>? includeItemTypes, List<BaseItemKind>? includeItemTypes,
}) async { }) async {
@ -705,6 +707,8 @@ class JellyService {
parentId: parentId, parentId: parentId,
userId: account?.id, userId: account?.id,
recursive: recursive, recursive: recursive,
sortBy: sortBy,
sortOrder: sortOrder,
includeItemTypes: includeItemTypes, includeItemTypes: includeItemTypes,
); );
} }