Skip to content

Commit

Permalink
fix: multi edit/save state
Browse files Browse the repository at this point in the history
  • Loading branch information
Regzox committed Nov 27, 2023
1 parent 8ef3992 commit e3b09af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ export class ManagementContractIdentificationTabComponent implements OnChanges {
}

submit(): void {
const subscription = this.prepareSubmit().subscribe(() => subscription.unsubscribe());
const subscription = this.prepareSubmit()
.pipe(tap((managementContract) => (this.managementContract = managementContract)))
.subscribe(() => subscription.unsubscribe());
}

prepareSubmit(): Observable<ManagementContract> {
Expand All @@ -86,6 +88,7 @@ export class ManagementContractIdentificationTabComponent implements OnChanges {
() => (this.sending = false),
() => (this.sending = false)
),
tap(() => this.updated.emit(false)),
tap(() => {
this.contractForm.markAsPristine();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { MatDialog } from '@angular/material/dialog';
import { MatTab, MatTabGroup, MatTabHeader } from '@angular/material/tabs';
import { ConfirmActionComponent } from 'projects/vitamui-library/src/public-api';
import { Subscription } from 'rxjs';
import { mergeMap, tap } from 'rxjs/operators';
import { tap } from 'rxjs/operators';
import { ManagementContract } from 'ui-frontend-common';
import { ManagementContractService } from '../management-contract.service';
import { ManagementContractIdentificationTabComponent } from './management-contract-identification-tab/management-contract-identification-tab.component';
Expand Down Expand Up @@ -114,7 +114,6 @@ export class ManagementContractPreviewComponent implements OnChanges, AfterViewI
const subscription: Subscription = this.tabLinks[this.tabs.selectedIndex]
.prepareSubmit()
.pipe(
mergeMap((managementContract) => this.managementContractService.get(managementContract.identifier)),
tap((managementContract) => {
this.inputManagementContract = managementContract;
})
Expand Down

0 comments on commit e3b09af

Please sign in to comment.