mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-26 07:31:50 +01:00
Fix issue with current source displaying in scraping screen
This commit is contained in:
parent
9dd8f372a6
commit
ecf1d901a3
@ -60,8 +60,10 @@ function useBaseScrape() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const startEvent = useCallback((id: ScraperEvent<"start">) => {
|
const startEvent = useCallback((id: ScraperEvent<"start">) => {
|
||||||
|
const lastIdTmp = lastId.current;
|
||||||
setSources((s) => {
|
setSources((s) => {
|
||||||
if (s[id]) s[id].status = "pending";
|
if (s[id]) s[id].status = "pending";
|
||||||
|
if (lastIdTmp && s[lastIdTmp]) s[lastIdTmp].status = "success";
|
||||||
return { ...s };
|
return { ...s };
|
||||||
});
|
});
|
||||||
setCurrentSource(id);
|
setCurrentSource(id);
|
||||||
|
@ -75,11 +75,8 @@ export function ScrapingPart(props: ScrapingProps) {
|
|||||||
})();
|
})();
|
||||||
}, [startScraping, props, report, isMounted]);
|
}, [startScraping, props, report, isMounted]);
|
||||||
|
|
||||||
const currentProvider = sourceOrder.find(
|
|
||||||
(s) => sources[s.id].status === "pending",
|
|
||||||
);
|
|
||||||
let currentProviderIndex = sourceOrder.findIndex(
|
let currentProviderIndex = sourceOrder.findIndex(
|
||||||
(provider) => currentProvider?.id === provider.id,
|
(s) => s.id === currentSource || s.children.includes(currentSource ?? ""),
|
||||||
);
|
);
|
||||||
if (currentProviderIndex === -1)
|
if (currentProviderIndex === -1)
|
||||||
currentProviderIndex = sourceOrder.length - 1;
|
currentProviderIndex = sourceOrder.length - 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user