Skip to content

Commit

Permalink
MDL-75423 core_grades: prevent multiple initialising of the group widget
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies authored and Mihail Geshoski committed Nov 10, 2022
1 parent 3cfb7cf commit fba91ab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grade/amd/build/searchwidget/group.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion grade/amd/build/searchwidget/group.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions grade/amd/src/searchwidget/group.js
Expand Up @@ -28,6 +28,13 @@ import * as Repository from 'core_grades/searchwidget/repository';
import * as WidgetBase from 'core_grades/searchwidget/basewidget';
import {get_string as getString} from 'core/str';

/**
* Whether the event listener has already been registered for this module.
*
* @type {boolean}
*/
let registered = false;

/**
* Our entry point into starting to build the group search widget.
*
Expand All @@ -36,9 +43,13 @@ import {get_string as getString} from 'core/str';
* @method init
*/
export const init = () => {
if (registered) {
return;
}
const pendingPromise = new Pending();
registerListenerEvents();
pendingPromise.resolve();
registered = true;
};

/**
Expand Down

0 comments on commit fba91ab

Please sign in to comment.