#4210 Änderungen werden nicht sofort angezeigt

This commit is contained in:
Lorenz Hilpert
2023-07-19 17:25:22 +02:00
parent ee81f795fe
commit efec7ecb26
5 changed files with 12 additions and 10 deletions

View File

@@ -165,7 +165,7 @@ export class CustomerSearchComponent implements OnInit, OnDestroy {
}
if (customerId !== this._store.customer?.id) {
this._store.selectCustomer(customerId);
this._store.selectCustomer({ customerId });
}
}

View File

@@ -140,6 +140,8 @@ export abstract class CustomerDataEditComponent implements OnInit {
try {
await this.customerService.patchCustomer(this.customerId, this.control.value).toPromise();
this._store.selectCustomer({ customerId: this._store.customerId, reload: true });
this.location.back();
} catch (error) {
this.control.enable();

View File

@@ -100,7 +100,7 @@ export class OrderDetailsMainViewComponent implements OnInit, OnDestroy {
});
this.customerId$.pipe(takeUntil(this._onDestroy)).subscribe((customerId) => {
this._store.selectCustomer(customerId);
this._store.selectCustomer({ customerId });
});
}

View File

@@ -77,7 +77,7 @@ export class CustomerOrderItemListItemComponent implements OnInit, OnDestroy {
ngOnInit() {
this.customerId$.pipe(takeUntil(this._onDestroy)).subscribe((customerId) => {
this._store.selectCustomer(+customerId);
this._store.selectCustomer({ customerId });
});
this.orderId$.pipe(takeUntil(this._onDestroy)).subscribe((orderId) => {

View File

@@ -186,17 +186,17 @@ export class CustomerSearchStore extends ComponentStore<CustomerSearchState> imp
setProcessId = this.updater((state, processId: number) => ({ ...state, processId }));
selectCustomer = this.effect((customerId$: Observable<number>) =>
customerId$.pipe(
selectCustomer = this.effect((options$: Observable<{ customerId: number; reload?: boolean }>) =>
options$.pipe(
distinctUntilChanged(),
filter((customerId) => !!customerId && Number(customerId) !== this.customerId),
tap((custoemrId) => {
this.patchState({ fetchingCustomer: true, customer: { id: custoemrId } });
filter(({ customerId, reload }) => reload || (!!customerId && Number(customerId) !== this.customerId)),
tap(({ customerId }) => {
this.patchState({ fetchingCustomer: true, customer: { id: +customerId } });
this.restoreCustomerInfo();
}),
switchMap((customerId) =>
switchMap(({ customerId }) =>
this._customerService
.getCustomer(customerId, 2)
.getCustomer(+customerId, 2)
.pipe(tapResponse(this.handleSelectCustomerResponse, this.handleSelectCustomerError, this.handleSelectCustomerComplete))
)
)