@sumaris-net/ngx-components 2.2.4 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21374,11 +21374,17 @@ class MenuComponent {
21374
21374
  .pipe(distinctUntilChanged())
21375
21375
  .subscribe((value) => value ? this.open() : this.close());
21376
21376
  // Update component when refresh is need (=login events or config changed)
21377
- this._subscription.add(merge(merge(this.accountService.onLogin, this.accountService.onLogout)
21377
+ this._subscription.add(merge(merge(this.accountService.onLogin
21378
21378
  .pipe(
21379
+ // DEBUG
21380
+ //tap(account => console.debug('[menu] Receiving login event', account)),
21381
+ distinctUntilChanged((a1, a2) => !DateUtils.isSame(a1?.updateDate, a2?.updateDate))), this.configService.config
21382
+ .pipe(tap(config => this._config = config)))
21383
+ .pipe(
21384
+ // Add debounce to avoid to trigger twice, at startup
21385
+ debounceTime(250),
21379
21386
  // Wait account service ready (can be restarted)
21380
- mergeMap(() => this.accountService.ready()), map(() => this.accountService.isLogin()), distinctUntilChanged()), this.configService.config
21381
- .pipe(tap(config => this._config = config), mergeMap(() => this.accountService.ready()), map(() => this.accountService.isLogin())))
21387
+ mergeMap(() => this.accountService.ready()), map(() => this.accountService.isLogin())), this.accountService.onLogout)
21382
21388
  .subscribe(login => {
21383
21389
  if (login) {
21384
21390
  this.onLogin(this.accountService.account);
@@ -21389,7 +21395,7 @@ class MenuComponent {
21389
21395
  }));
21390
21396
  }
21391
21397
  async onLogin(account) {
21392
- console.info('[menu] Update (login)');
21398
+ console.info('[menu] Update (on login)');
21393
21399
  this.accountAvatar = account.avatar;
21394
21400
  this.accountName = account.displayName;
21395
21401
  this.accountEmail = account.email;
@@ -21405,7 +21411,7 @@ class MenuComponent {
21405
21411
  console.debug('[menu] Logout');
21406
21412
  }
21407
21413
  else {
21408
- console.debug('[menu] Update (logout)');
21414
+ console.debug('[menu] Update (on logout)');
21409
21415
  }
21410
21416
  this.isLogin = false;
21411
21417
  this.accountAvatar = null;