From 132007b2079b95fc01ae75d527f21088fda035d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 1 Dec 2021 16:19:26 +0100 Subject: [PATCH] MOBILE-3099 core: Improve collapsible headers loading search --- src/core/directives/collapsible-header.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/directives/collapsible-header.ts b/src/core/directives/collapsible-header.ts index 11191f7c6..626a5e7b6 100644 --- a/src/core/directives/collapsible-header.ts +++ b/src/core/directives/collapsible-header.ts @@ -48,8 +48,12 @@ export class CoreCollapsibleHeaderDirective implements OnDestroy { this.header = el.nativeElement; this.loadingObserver = CoreEvents.on(CoreEvents.CORE_LOADING_CHANGED, async (data) => { + if (!data.loaded) { + return; + } + const loadingId = await this.getLoadingId(); - if (loadingId && data.loaded && data.uniqueId == loadingId) { + if (loadingId && data.uniqueId == loadingId) { // Remove event when loading is done. this.loadingObserver.off(); @@ -78,7 +82,7 @@ export class CoreCollapsibleHeaderDirective implements OnDestroy { } } - return this.content.querySelector('core-loading .core-loading-content')?.id; + return this.content.querySelector('core-loading.core-loading-loaded:not(.core-loading-inline) .core-loading-content')?.id; } /**