Skip to content

Commit

Permalink
fix: mini cart opens if the user navigates from checkout to other pag…
Browse files Browse the repository at this point in the history
…es (#688)

- use shareReplay to detect basket changes
  • Loading branch information
Eisie96 authored May 11, 2021
1 parent 3eab2f7 commit 5a0ed25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/core/facades/checkout.facade.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Store, createSelector, select } from '@ngrx/store';
import { merge } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, switchMap, take, tap } from 'rxjs/operators';
import { debounceTime, distinctUntilChanged, map, shareReplay, switchMap, take, tap } from 'rxjs/operators';

import { Address } from 'ish-core/models/address/address.model';
import { Attribute } from 'ish-core/models/attribute/attribute.model';
Expand Down Expand Up @@ -72,7 +72,8 @@ export class CheckoutFacade {
select(getBasketLastTimeProductAdded),
whenTruthy(),
distinctUntilChanged(),
switchMap(() => this.basketLoading$.pipe(debounceTime(500), whenFalsy()))
switchMap(() => this.basketLoading$.pipe(debounceTime(500), whenFalsy())),
shareReplay(1)
);
basketError$ = this.store.pipe(select(getBasketError));
basketInfo$ = this.store.pipe(select(getBasketInfo));
Expand Down

0 comments on commit 5a0ed25

Please sign in to comment.