mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 2004: 🐛 fix(checkout): remove manual cart counter updates (#5412)
🐛 fix(checkout): remove manual cart counter updates (#5412) Remove updateProcessCount method and all manual calls to it. The cart counter is now updated through reactive mechanisms, ensuring it stays in sync when items are added or removed. Fixes bug where reward cart icon counter was not updating when items were removed from the cart. Related work items: #5412
This commit is contained in:
committed by
Nino Righi
parent
a2833b669d
commit
d46bf462cb
@@ -127,7 +127,6 @@ export class DomainCheckoutService {
|
||||
.pipe(
|
||||
map((response) => response.result),
|
||||
tap((shoppingCart) => {
|
||||
this.updateProcessCount(processId, shoppingCart);
|
||||
this.store.dispatch(
|
||||
DomainCheckoutActions.setShoppingCart({
|
||||
processId,
|
||||
@@ -159,7 +158,6 @@ export class DomainCheckoutService {
|
||||
}),
|
||||
);
|
||||
|
||||
this.updateProcessCount(processId, cart.result);
|
||||
this.store.dispatch(
|
||||
DomainCheckoutActions.setShoppingCart({
|
||||
processId,
|
||||
@@ -210,7 +208,6 @@ export class DomainCheckoutService {
|
||||
.pipe(
|
||||
map((response) => response.result),
|
||||
tap((shoppingCart) => {
|
||||
this.updateProcessCount(processId, shoppingCart);
|
||||
this.store.dispatch(
|
||||
DomainCheckoutActions.setShoppingCart({
|
||||
processId,
|
||||
@@ -425,8 +422,6 @@ export class DomainCheckoutService {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
this.updateProcessCount(processId, shoppingCart);
|
||||
}),
|
||||
),
|
||||
),
|
||||
@@ -1432,7 +1427,7 @@ export class DomainCheckoutService {
|
||||
): Observable<{ [key: string]: boolean }> {
|
||||
return this.canSetCustomer({ processId, customerFeatures: undefined }).pipe(
|
||||
map((res) => {
|
||||
let setableTypes: { [key: string]: boolean } = {
|
||||
const setableTypes: { [key: string]: boolean } = {
|
||||
store: false,
|
||||
guest: false,
|
||||
webshop: false,
|
||||
@@ -1627,13 +1622,4 @@ export class DomainCheckoutService {
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Common
|
||||
|
||||
async updateProcessCount(processId: number, shoppingCart: ShoppingCartDTO) {
|
||||
this.applicationService.patchProcessData(processId, {
|
||||
count: shoppingCart.items?.length ?? 0,
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user