MOBILE-3320 home: Try to prevent empty box displayed for an instant

main
Dani Palou 2021-06-17 09:05:29 +02:00
parent da050a66c8
commit c2e82f7ad1
2 changed files with 6 additions and 4 deletions

View File

@ -12,9 +12,7 @@
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<ng-container *ngIf="tabs.length == 0"> <core-empty-box *ngIf="tabs.length == 0" icon="fas-home" [message]="'core.courses.nocourses' | translate"></core-empty-box>
<core-empty-box icon="fas-home" [message]="'core.courses.nocourses' | translate"></core-empty-box>
</ng-container>
</core-loading> </core-loading>
<core-tabs-outlet *ngIf="tabs.length > 0" [selectedIndex]="selectedTab" [hideUntil]="loaded" [tabs]="tabs" <core-tabs-outlet *ngIf="tabs.length > 0" [selectedIndex]="selectedTab" [hideUntil]="loaded" [tabs]="tabs"
(ionChange)="tabSelected()"> (ionChange)="tabSelected()">

View File

@ -86,6 +86,7 @@ export class CoreMainMenuHomePage implements OnInit {
*/ */
initHandlers(handlers: CoreMainMenuHomeHandlerToDisplay[]): void { initHandlers(handlers: CoreMainMenuHomeHandlerToDisplay[]): void {
// Re-build the list of tabs. // Re-build the list of tabs.
const loaded = CoreMainMenuHomeDelegate.areHandlersLoaded();
const handlersMap = CoreUtils.arrayToObject(handlers, 'title'); const handlersMap = CoreUtils.arrayToObject(handlers, 'title');
const newTabs = handlers.map((handler): CoreTabsOutletTab => { const newTabs = handlers.map((handler): CoreTabsOutletTab => {
const tab = this.tabs.find(tab => tab.title == handler.title); const tab = this.tabs.find(tab => tab.title == handler.title);
@ -125,7 +126,10 @@ export class CoreMainMenuHomePage implements OnInit {
this.tabs = newTabs; this.tabs = newTabs;
this.loaded = CoreMainMenuHomeDelegate.areHandlersLoaded(); // Try to prevent empty box displayed for an instant when it shouldn't.
setTimeout(() => {
this.loaded = loaded;
}, 50);
} }
/** /**