mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-21 19:53:43 +08:00
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:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user