diff --git a/projects/valtimo/dossier/src/lib/models/tabs.model.ts b/projects/valtimo/dossier/src/lib/models/tabs.model.ts index c756efad4..6b80d1ab0 100644 --- a/projects/valtimo/dossier/src/lib/models/tabs.model.ts +++ b/projects/valtimo/dossier/src/lib/models/tabs.model.ts @@ -71,14 +71,14 @@ export class TabLoaderImpl implements TabLoader { initialTab = this._tabs[0] || null; } - this.load(initialTab); + this.load(initialTab, true); } - public load(newTab: TabImpl): void { + public load(newTab: TabImpl, isInitial = false): void { if (newTab !== this._activeTab) { this._tabs.forEach(tab => tab.deactivate()); this.replaceView(newTab); - this.replaceUrlState(newTab); + if (!isInitial) this.replaceUrlState(newTab); this.setActive(newTab); } } diff --git a/projects/valtimo/zgw/src/lib/modules/documenten-api/components/documenten-api-documents/documenten-api-documents.component.html b/projects/valtimo/zgw/src/lib/modules/documenten-api/components/documenten-api-documents/documenten-api-documents.component.html index 800f2372f..bff0c86f0 100644 --- a/projects/valtimo/zgw/src/lib/modules/documenten-api/components/documenten-api-documents/documenten-api-documents.component.html +++ b/projects/valtimo/zgw/src/lib/modules/documenten-api/components/documenten-api-documents/documenten-api-documents.component.html @@ -21,8 +21,7 @@ uploading: uploading$ | async, relatedFiles: relatedFiles$ | async, fields: fields$ | async, - initialSortState: initialSortState$ | async, - supportedDocumentenApiFeatures: supportedDocumentenApiFeatures$ | async + supportedDocumentenApiFeatures: supportedDocumentenApiFeatures$ | async, } as obs" > @if ((!obs.fieldsLoading && obs.fields.length) || obs.fieldsLoading) { @@ -31,9 +30,6 @@ [items]="obs.relatedFiles" [fields]="obs.fields" [loading]="obs.loading" - [initialSortState]=" - obs?.supportedDocumentenApiFeatures?.supportsSortableColumns && obs.initialSortState - " (rowClicked)="onRowClick($event)" (sortChanged)=" obs?.supportedDocumentenApiFeatures?.supportsSortableColumns && onSortChanged($event) diff --git a/projects/valtimo/zgw/src/lib/modules/documenten-api/components/documenten-api-documents/documenten-api-documents.component.ts b/projects/valtimo/zgw/src/lib/modules/documenten-api/components/documenten-api-documents/documenten-api-documents.component.ts index 8b04dcf55..33b45a34c 100644 --- a/projects/valtimo/zgw/src/lib/modules/documenten-api/components/documenten-api-documents/documenten-api-documents.component.ts +++ b/projects/valtimo/zgw/src/lib/modules/documenten-api/components/documenten-api-documents/documenten-api-documents.component.ts @@ -99,13 +99,14 @@ export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit, combineLatest([ this.documentenApiColumnService.getConfiguredColumns(documentDefinitionName), this._supportedDocumentenApiFeatures$, + this._sort$, ]) ), - map(([columns, supportedDocumentenApiFeatures]) => { + map(([columns, supportedDocumentenApiFeatures, sort]) => { const defaultSortColumn: ConfiguredColumn | undefined = columns.find( (column: ConfiguredColumn) => !!column.defaultSort ); - if (!!defaultSortColumn && supportedDocumentenApiFeatures.supportsSortableColumns) { + if (!!defaultSortColumn && !sort && supportedDocumentenApiFeatures.supportsSortableColumns) { this._sort$.next({sort: `${defaultSortColumn.key},${defaultSortColumn.defaultSort}`}); } @@ -153,25 +154,6 @@ export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit, filter(documentId => !!documentId) ); - public readonly initialSortState$: Observable = this.route.queryParamMap.pipe( - map(params => params['params']), - map(params => { - if (!!params['sort']) { - const paramsSplit = params['sort'].split(','); - const state = { - name: paramsSplit[0], - direction: paramsSplit[1], - }; - - return { - isSorting: true, - state, - }; - } - return null; - }) - ); - public isAdmin: boolean; public showZaakLinkWarning: boolean; public uploadProcessLinkedSet = false; @@ -256,7 +238,6 @@ export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit, public ngOnInit(): void { this.setInitialFilterAndSort(); - this.openQueryParamsSubscription(); this.setUploadProcessLinked(); this.isUserAdmin(); this.iconService.registerAll([Filter16, TagGroup16, Upload16]); @@ -456,6 +437,7 @@ export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit, .subscribe(({filter, sort}) => { this._sort$.next({sort}); this.filter$.next(filter); + this.openQueryParamsSubscription(); }); } }