MOBILE-3833 user: Fix handler cache clear

main
Noel De Martin 2021-11-17 13:06:55 +01:00
parent 9987c3bcf9
commit 57532fd393
1 changed files with 7 additions and 1 deletions

View File

@ -397,8 +397,14 @@ export class CoreUserDelegateService extends CoreDelegate<CoreUserProfileHandler
*/
protected clearHandlerCache(courseId?: number, userId?: number): void {
if (courseId && userId) {
const cacheKey = this.getCacheKey(courseId, userId);
Object.keys(this.enabledHandlers).forEach((name) => {
delete this.enabledForUserCache[name][this.getCacheKey(courseId, userId)];
const cache = this.enabledForUserCache[name];
if (cache) {
delete cache[cacheKey];
}
});
} else {
this.enabledForUserCache = {};