feat: Implement parallel multi-page fetching from each search source and introduce client-side load more pagination for aggregated results.

This commit is contained in:
kuekhaoyang
2026-02-16 11:32:20 +08:00
parent d54039663a
commit bc25be5b05
11 changed files with 184 additions and 23 deletions
+12 -1
View File
@@ -18,6 +18,9 @@ interface ParallelSearchResult {
resetSearch: () => void;
loadCachedResults: (results: Video[], sources: any[]) => void;
applySorting: (sortBy: SortOption) => void;
loadMore: () => Promise<void>;
hasMore: boolean;
loadingMore: boolean;
}
export function useParallelSearch(
@@ -32,18 +35,23 @@ export function useParallelSearch(
completedSources,
totalSources,
totalVideosFound,
currentPage,
maxPageCount,
loadingMore,
setResults,
setAvailableSources,
setTotalVideosFound,
resetState,
} = state;
const { performSearch, cancelSearch } = useSearchAction({
const { performSearch, loadMore: loadMoreAction, cancelSearch } = useSearchAction({
state,
onCacheUpdate,
onUrlUpdate,
});
const hasMore = currentPage < maxPageCount;
/**
* Reset search state
*/
@@ -79,6 +87,9 @@ export function useParallelSearch(
resetSearch,
loadCachedResults,
applySorting,
loadMore: loadMoreAction,
hasMore,
loadingMore,
};
}