From e77916a9bb6814cc341f54ee90de387ee9dba253 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 10 Jan 2019 13:30:18 +0100 Subject: [PATCH] MOBILE-2795 core: Select first site in site picker if no current --- src/components/site-picker/site-picker.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/site-picker/site-picker.ts b/src/components/site-picker/site-picker.ts index da4cf8d41..51538eec7 100644 --- a/src/components/site-picker/site-picker.ts +++ b/src/components/site-picker/site-picker.ts @@ -57,6 +57,12 @@ export class CoreSitePickerComponent implements OnInit { })); }); + if (!this.selectedSite && sites.length) { + // There is no current site, select the first one. + this.selectedSite = sites[0].id; + this.siteSelected.emit(this.selectedSite); + } + return Promise.all(promises).then(() => { this.sites = sites; });