diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 328e97c48..241bff963 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -9,7 +9,7 @@ "downloadStarted": "started download of {{count}} items", "editPlaylist": "edit $t(entity.playlist_one)", "goToPage": "go to page", - "largeFetch": "this action will attempt to fetch {{count}} items from your server", + "largeFetch": "this action will make {{count}} network requests to your server", "moveToNext": "move to next", "moveToBottom": "move to bottom", "moveToTop": "move to top", diff --git a/src/renderer/features/player/context/player-context.tsx b/src/renderer/features/player/context/player-context.tsx index e712ae859..6ad203acb 100644 --- a/src/renderer/features/player/context/player-context.tsx +++ b/src/renderer/features/player/context/player-context.tsx @@ -375,9 +375,21 @@ export const PlayerProvider = ({ children }: { children: React.ReactNode }) => { })) as number; totalCount = countResult || 0; - // Check if we need confirmation - if (totalCount > queueFetchConfirmThreshold) { - const confirmed = await confirmLargeFetch(totalCount); + const allResults: Song[] | string[] = []; + const pageSize = 500; + + // Calculate the number of fetches needed + let numberOfFetches = 0; + if (itemType === LibraryItem.SONG) { + // For songs, the number of fetches is based on pagination + numberOfFetches = Math.ceil(totalCount / pageSize); + } else { + const paginationFetches = Math.ceil(totalCount / pageSize); + numberOfFetches = paginationFetches + totalCount; + } + + if (numberOfFetches > queueFetchConfirmThreshold) { + const confirmed = await confirmLargeFetch(numberOfFetches); if (!confirmed) { return; } @@ -411,10 +423,6 @@ export const PlayerProvider = ({ children }: { children: React.ReactNode }) => { }); }, 2000), }; - - // Paginate through all items to collect IDs - const allResults: Song[] | string[] = []; - const pageSize = 500; // Fetch in chunks let startIndex = 0; while (startIndex < totalCount) {