You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The 3 flags must be false to trigger the load. After the initial page load the success is turned to true and remains true after you change the language. However, changing the language resets the carts content in the store. See cart-effect.ts resetCartDetailsOnSiteContextChange$: Observable<CartActions.ResetCartDetails> = createEffect(() => this.actions$.pipe( ofType( SiteContextActions.LANGUAGE_CHANGE, SiteContextActions.CURRENCY_CHANGE ), mergeMap(() => { return [new CartActions.ResetCartDetails()]; }) ) );
So, carts are cleared and no reload is triggered.
The solution is to trigger ClearSavedCarts action upon context change, e.g. resetCartDetailsOnSiteContextChange$: Observable<CartActions.ResetCartDetails | SavedCartActions.ClearSavedCarts> = createEffect(() => this.actions$.pipe( ofType( SiteContextActions.LANGUAGE_CHANGE, SiteContextActions.CURRENCY_CHANGE ), mergeMap(() => { return [new CartActions.ResetCartDetails(), new SavedCartActions.ClearSavedCarts()]; }) ) );
The ClearSavedCarts causes the flags succes, loading and error to be false
The text was updated successfully, but these errors were encountered:
Describe
Saved cart list disappears when the language is changed from the language context selector.
Version
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The list still shows 2 carts
What happens is
The list disappears.
Explanation
The list gets loaded by calling the SavedCartService.getList(). This checks the following state in the store
The 3 flags must be false to trigger the load. After the initial page load the success is turned to true and remains true after you change the language. However, changing the language resets the carts content in the store. See cart-effect.ts
resetCartDetailsOnSiteContextChange$: Observable<CartActions.ResetCartDetails> = createEffect(() => this.actions$.pipe( ofType( SiteContextActions.LANGUAGE_CHANGE, SiteContextActions.CURRENCY_CHANGE ), mergeMap(() => { return [new CartActions.ResetCartDetails()]; }) ) );
So, carts are cleared and no reload is triggered.
The solution is to trigger ClearSavedCarts action upon context change, e.g.
resetCartDetailsOnSiteContextChange$: Observable<CartActions.ResetCartDetails | SavedCartActions.ClearSavedCarts> = createEffect(() => this.actions$.pipe( ofType( SiteContextActions.LANGUAGE_CHANGE, SiteContextActions.CURRENCY_CHANGE ), mergeMap(() => { return [new CartActions.ResetCartDetails(), new SavedCartActions.ClearSavedCarts()]; }) ) );
The ClearSavedCarts causes the flags succes, loading and error to be false
The text was updated successfully, but these errors were encountered: