Fix issue with current source displaying in scraping screen

This commit is contained in:
mrjvs 2023-12-29 21:35:09 +01:00
parent 9dd8f372a6
commit ecf1d901a3
2 changed files with 3 additions and 4 deletions

View File

@ -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);

View File

@ -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;