From 42e368140746fa1c735701635c4529db551c7385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 22 Feb 2022 15:34:42 +0100 Subject: [PATCH] MOBILE-3833 assign: Invalidate submission component before is null --- src/addons/mod/assign/components/index/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/addons/mod/assign/components/index/index.ts b/src/addons/mod/assign/components/index/index.ts index c78728728..226d5e28a 100644 --- a/src/addons/mod/assign/components/index/index.ts +++ b/src/addons/mod/assign/components/index/index.ts @@ -109,7 +109,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo AddonModAssignProvider.SUBMISSION_SAVED_EVENT, (data) => { if (this.assign && data.assignmentId == this.assign.id && data.userId == this.currentUserId) { - // Assignment submission saved, refresh data. + // Assignment submission saved, refresh data. this.showLoadingAndRefresh(true, false); } }, @@ -326,6 +326,8 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo const promises: Promise[] = []; promises.push(AddonModAssign.invalidateAssignmentData(this.courseId)); + // Invalidate before component becomes null. + promises.push(this.submissionComponent?.invalidateAndRefresh(true) || Promise.resolve()); if (this.assign) { promises.push(AddonModAssign.invalidateAllSubmissionData(this.assign.id)); @@ -335,9 +337,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo } } - await Promise.all(promises).finally(() => { - this.submissionComponent?.invalidateAndRefresh(true); - }); + await Promise.all(promises); } /**