MOBILE-3833 collapsible: Fix disabled collapsible header on error

main
Pau Ferrer Ocaña 2022-03-29 13:04:19 +02:00
parent b25d5d5fca
commit e750ef2c6e
1 changed files with 6 additions and 2 deletions

View File

@ -208,7 +208,11 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
this.expandedHeader = this.page?.querySelector('ion-item[collapsible]') ?? undefined;
if (!this.expandedHeader) {
this.enabled = false;
this.setEnabled(this.enabled);
throw new Error('[collapsible-header] Couldn\'t initialize expanded header');
}
this.expandedHeader.classList.add('collapsible-header-expanded');
@ -384,11 +388,11 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
* @param enable True to enable, false otherwise
*/
async setEnabled(enable: boolean): Promise<void> {
if (!this.page || !this.content) {
if (!this.page) {
return;
}
if (enable) {
if (enable && this.content) {
const contentScroll = await this.content.getScrollElement();
// Do nothing, since scroll has already started on the page.