@@ -11,6 +11,7 @@ import {
1111 OnDestroy ,
1212 OnInit ,
1313 PLATFORM_ID ,
14+ SimpleChanges ,
1415} from '@angular/core' ;
1516import {
1617 ActivatedRoute ,
@@ -26,8 +27,8 @@ import {
2627 Subscription ,
2728} from 'rxjs' ;
2829import {
30+ distinctUntilChanged ,
2931 map ,
30- take ,
3132} from 'rxjs/operators' ;
3233import { ThemedBrowseByComponent } from 'src/app/shared/browse-by/themed-browse-by.component' ;
3334
@@ -51,20 +52,13 @@ import { BrowseEntry } from '../../core/shared/browse-entry.model';
5152import { Context } from '../../core/shared/context.model' ;
5253import { Item } from '../../core/shared/item.model' ;
5354import { getFirstSucceededRemoteData } from '../../core/shared/operators' ;
54- import { ThemedComcolPageBrowseByComponent } from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component' ;
55- import { ThemedComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/themed-comcol-page-content.component' ;
56- import { ThemedComcolPageHandleComponent } from '../../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component' ;
57- import { ComcolPageHeaderComponent } from '../../shared/comcol/comcol-page-header/comcol-page-header.component' ;
58- import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component' ;
59- import { DsoEditMenuComponent } from '../../shared/dso-page/dso-edit-menu/dso-edit-menu.component' ;
6055import {
6156 hasValue ,
6257 isNotEmpty ,
6358} from '../../shared/empty.util' ;
6459import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component' ;
6560import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model' ;
6661import { StartsWithType } from '../../shared/starts-with/starts-with-type' ;
67- import { VarDirective } from '../../shared/utils/var.directive' ;
6862import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type' ;
6963
7064export const BBM_PAGINATION_ID = 'bbm' ;
@@ -74,15 +68,8 @@ export const BBM_PAGINATION_ID = 'bbm';
7468 styleUrls : [ './browse-by-metadata.component.scss' ] ,
7569 templateUrl : './browse-by-metadata.component.html' ,
7670 imports : [
77- VarDirective ,
7871 AsyncPipe ,
79- ComcolPageHeaderComponent ,
80- ComcolPageLogoComponent ,
8172 NgIf ,
82- ThemedComcolPageHandleComponent ,
83- ThemedComcolPageContentComponent ,
84- DsoEditMenuComponent ,
85- ThemedComcolPageBrowseByComponent ,
8673 TranslateModule ,
8774 ThemedLoadingComponent ,
8875 ThemedBrowseByComponent ,
@@ -232,21 +219,22 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, OnDestroy {
232219 return ;
233220 }
234221 const sortConfig = new SortOptions ( 'default' , SortDirection . ASC ) ;
235- this . updatePage ( getBrowseSearchOptions ( this . defaultBrowseId , this . paginationConfig , sortConfig ) ) ;
236222 this . currentPagination$ = this . paginationService . getCurrentPagination ( this . paginationConfig . id , this . paginationConfig ) ;
237223 this . currentSort$ = this . paginationService . getCurrentSort ( this . paginationConfig . id , sortConfig ) ;
224+ const routeParams$ : Observable < Params > = observableCombineLatest ( [
225+ this . route . params ,
226+ this . route . queryParams ,
227+ ] ) . pipe (
228+ map ( ( [ params , queryParams ] : [ Params , Params ] ) => Object . assign ( { } , params , queryParams ) ) ,
229+ distinctUntilChanged ( ( prev : Params , curr : Params ) => prev . id === curr . id && prev . authority === curr . authority && prev . value === curr . value && prev . startsWith === curr . startsWith ) ,
230+ ) ;
238231 this . subs . push (
239- observableCombineLatest (
240- [ this . route . params . pipe ( take ( 1 ) ) ,
241- this . route . queryParams ,
242- this . scope$ ,
243- this . currentPagination$ ,
244- this . currentSort$ ,
245- ] ) . pipe (
246- map ( ( [ routeParams , queryParams , scope , currentPage , currentSort ] ) => {
247- return [ Object . assign ( { } , routeParams , queryParams ) , scope , currentPage , currentSort ] ;
248- } ) ,
249- ) . subscribe ( ( [ params , scope , currentPage , currentSort ] : [ Params , string , PaginationComponentOptions , SortOptions ] ) => {
232+ observableCombineLatest ( [
233+ routeParams$ ,
234+ this . scope$ ,
235+ this . currentPagination$ ,
236+ this . currentSort$ ,
237+ ] ) . subscribe ( ( [ params , scope , currentPage , currentSort ] : [ Params , string , PaginationComponentOptions , SortOptions ] ) => {
250238 this . browseId = params . id || this . defaultBrowseId ;
251239 this . authority = params . authority ;
252240
@@ -274,8 +262,10 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, OnDestroy {
274262
275263 }
276264
277- ngOnChanges ( ) : void {
278- this . scope$ . next ( this . scope ) ;
265+ ngOnChanges ( changes : SimpleChanges ) : void {
266+ if ( hasValue ( changes . scope ) ) {
267+ this . scope$ . next ( this . scope ) ;
268+ }
279269 }
280270
281271 /**
0 commit comments