diff --git a/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx b/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx index a7eb5cf25..800cad293 100644 --- a/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx +++ b/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx @@ -147,7 +147,10 @@ function StatusScreen(props: Props) { } if (section.canRetryAll) { - itemsHtml.push(renderSectionRetryAllHtml(section.title, section.retryAllHandler)); + itemsHtml.push(renderSectionRetryAllHtml(section.title, async () => { + await section.retryAllHandler(); + void resfreshScreen(); + })); } return
{itemsHtml}
; diff --git a/packages/lib/services/ReportService.ts b/packages/lib/services/ReportService.ts index adec57ec1..8fb073efd 100644 --- a/packages/lib/services/ReportService.ts +++ b/packages/lib/services/ReportService.ts @@ -140,6 +140,28 @@ export default class ReportService { return output; } + private addRetryAllHandler(section: ReportSection): ReportSection { + const retryHandlers: Function[] = []; + + for (let i = 0; i < section.body.length; i++) { + const item: RerportItemOrString = section.body[i]; + if (typeof item !== 'string' && item.canRetry) { + retryHandlers.push(item.retryHandler); + } + } + + if (retryHandlers.length) { + section.canRetryAll = true; + section.retryAllHandler = async () => { + for (const retryHandler of retryHandlers) { + await retryHandler(); + } + }; + } + + return section; + } + async status(syncTarget: number): Promise { const r = await this.syncStatus(syncTarget); const sections: ReportSection[] = []; @@ -175,6 +197,8 @@ export default class ReportService { section.body.push({ type: ReportItemType.CloseList }); + section = this.addRetryAllHandler(section); + sections.push(section); } @@ -200,23 +224,7 @@ export default class ReportService { }); } - const retryHandlers: Function[] = []; - - for (let i = 0; i < section.body.length; i++) { - const item: RerportItemOrString = section.body[i]; - if (typeof item !== 'string' && item.canRetry) { - retryHandlers.push(item.retryHandler); - } - } - - if (retryHandlers.length > 1) { - section.canRetryAll = true; - section.retryAllHandler = async () => { - for (const retryHandler of retryHandlers) { - await retryHandler(); - } - }; - } + section = this.addRetryAllHandler(section); sections.push(section); }