diff --git a/src/session/DeputyRootSession.ts b/src/session/DeputyRootSession.ts index d8a25635..2cd05bcc 100644 --- a/src/session/DeputyRootSession.ts +++ b/src/session/DeputyRootSession.ts @@ -529,6 +529,8 @@ export default class DeputyRootSession { await casePage.addActiveSection( sectionName ); heading.insertAdjacentElement( 'afterend', el.render() ); + await el.loadData(); + mw.hook( 'deputy.load.cci.root' ).fire(); return true; } diff --git a/src/ui/root/DeputyContributionSurveyRevision.tsx b/src/ui/root/DeputyContributionSurveyRevision.tsx index 53d5d887..427b7c07 100644 --- a/src/ui/root/DeputyContributionSurveyRevision.tsx +++ b/src/ui/root/DeputyContributionSurveyRevision.tsx @@ -172,7 +172,6 @@ export default class DeputyContributionSurveyRevision * @inheritDoc */ render(): HTMLElement { - const commentElement = as HTMLElement; - this.loadData(); - return this.rootElement; } diff --git a/src/ui/root/DeputyContributionSurveySection.tsx b/src/ui/root/DeputyContributionSurveySection.tsx index 708afc20..04120a28 100644 --- a/src/ui/root/DeputyContributionSurveySection.tsx +++ b/src/ui/root/DeputyContributionSurveySection.tsx @@ -301,6 +301,9 @@ export default class DeputyContributionSurveySection implements DeputyUIElement csr, rowElements[ csr.title.getPrefixedText() ], line, this ); } catch ( e ) { + console.warn( 'Could not parse row.', line, e ); + // For debugging and tests. + mw.hook( 'deputy.errors.cciRowParse' ).fire( { line, e } ); rowElement = line; } if ( typeof rowElement !== 'string' ) { @@ -394,6 +397,15 @@ export default class DeputyContributionSurveySection implements DeputyUIElement } ); } + /** + * Makes all rows of this section being loading data. + * + * @return A Promise that resolves when all rows have finished loading data. + */ + async loadData(): Promise { + await Promise.all( this.rows.map( row => row.loadData() ) ); + } + /** * @inheritDoc */