MDL-74987 core_courseformat: add pending to refresh activity
The activity reload was missing a pending control. This can lead to behat errors if the module refresh takes longer than expected for some reason.
This commit is contained in:
+2
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -33,6 +33,7 @@ import DispatchActions from 'core_courseformat/local/content/actions';
|
||||
import * as CourseEvents from 'core_course/events';
|
||||
// The jQuery module is only used for interacting with Boostrap 4. It can we removed when MDL-71979 is integrated.
|
||||
import jQuery from 'jquery';
|
||||
import Pending from 'core/pending';
|
||||
|
||||
export default class Component extends BaseComponent {
|
||||
|
||||
@@ -502,11 +503,13 @@ export default class Component extends BaseComponent {
|
||||
* @param {object} param0.element the state object
|
||||
*/
|
||||
_reloadCm({element}) {
|
||||
const pendingReload = new Pending(`courseformat/content:reloadCm_${element.id}`);
|
||||
const cmitem = this.getElement(this.selectors.CM, element.id);
|
||||
if (cmitem) {
|
||||
const promise = courseActions.refreshModule(cmitem, element.id);
|
||||
promise.then(() => {
|
||||
this._indexContents();
|
||||
pendingReload.resolve();
|
||||
return;
|
||||
}).catch();
|
||||
}
|
||||
@@ -522,11 +525,13 @@ export default class Component extends BaseComponent {
|
||||
* @param {object} param0.element the state object
|
||||
*/
|
||||
_reloadSection({element}) {
|
||||
const pendingReload = new Pending(`courseformat/content:reloadSection_${element.id}`);
|
||||
const sectionitem = this.getElement(this.selectors.SECTION, element.id);
|
||||
if (sectionitem) {
|
||||
const promise = courseActions.refreshSection(sectionitem, element.id);
|
||||
promise.then(() => {
|
||||
this._indexContents();
|
||||
pendingReload.resolve();
|
||||
return;
|
||||
}).catch();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user