diff --git a/src/hooks/useProviderScrape.tsx b/src/hooks/useProviderScrape.tsx index 44f823da..7e1ab4bf 100644 --- a/src/hooks/useProviderScrape.tsx +++ b/src/hooks/useProviderScrape.tsx @@ -60,8 +60,10 @@ function useBaseScrape() { }, []); const startEvent = useCallback((id: ScraperEvent<"start">) => { + const lastIdTmp = lastId.current; setSources((s) => { if (s[id]) s[id].status = "pending"; + if (lastIdTmp && s[lastIdTmp]) s[lastIdTmp].status = "success"; return { ...s }; }); setCurrentSource(id); diff --git a/src/pages/parts/player/ScrapingPart.tsx b/src/pages/parts/player/ScrapingPart.tsx index ea86ee57..6687d3b1 100644 --- a/src/pages/parts/player/ScrapingPart.tsx +++ b/src/pages/parts/player/ScrapingPart.tsx @@ -75,11 +75,8 @@ export function ScrapingPart(props: ScrapingProps) { })(); }, [startScraping, props, report, isMounted]); - const currentProvider = sourceOrder.find( - (s) => sources[s.id].status === "pending", - ); let currentProviderIndex = sourceOrder.findIndex( - (provider) => currentProvider?.id === provider.id, + (s) => s.id === currentSource || s.children.includes(currentSource ?? ""), ); if (currentProviderIndex === -1) currentProviderIndex = sourceOrder.length - 1;