MOBILE-3833 user-menu: Fix blink effect in handlers
parent
78a51dbffa
commit
e6b76f705d
|
@ -79,12 +79,15 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handlers = [];
|
const newHandlers = handlers
|
||||||
handlers.forEach((handler) => {
|
.filter((handler) => handler.type === CoreUserDelegateService.TYPE_NEW_PAGE)
|
||||||
if (handler.type == CoreUserDelegateService.TYPE_NEW_PAGE) {
|
.map((handler) => handler.data);
|
||||||
this.handlers.push(handler.data);
|
|
||||||
}
|
// Only update handlers if they have changed, to prevent a blink effect.
|
||||||
});
|
if (newHandlers.length !== this.handlers.length ||
|
||||||
|
JSON.stringify(newHandlers) !== JSON.stringify(this.handlers)) {
|
||||||
|
this.handlers = newHandlers;
|
||||||
|
}
|
||||||
|
|
||||||
this.handlersLoaded = CoreUserDelegate.areHandlersLoaded(this.user.id, CoreUserDelegateContext.USER_MENU);
|
this.handlersLoaded = CoreUserDelegate.areHandlersLoaded(this.user.id, CoreUserDelegateContext.USER_MENU);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue