1- import { Component , EventEmitter , Input , OnInit , Output } from '@angular/core' ;
1+ import { Component , EventEmitter , Input , Output , OnChanges } from '@angular/core' ;
22import { DSpaceObject } from '../../core/shared/dspace-object.model' ;
33import { Router } from '@angular/router' ;
44import { isNotEmpty } from '../empty.util' ;
@@ -14,22 +14,15 @@ import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.serv
1414import { getFirstSucceededRemoteDataPayload } from '../../core/shared/operators' ;
1515import { DSONameService } from '../../core/breadcrumbs/dso-name.service' ;
1616
17- /**
18- * This component renders a simple item page.
19- * The route parameter 'id' is used to request the item it represents.
20- * All fields of the item that should be displayed, are defined in its template.
21- */
22-
2317@Component ( {
2418 selector : 'ds-search-form' ,
2519 styleUrls : [ './search-form.component.scss' ] ,
2620 templateUrl : './search-form.component.html'
2721} )
28-
2922/**
3023 * Component that represents the search form
3124 */
32- export class SearchFormComponent implements OnInit {
25+ export class SearchFormComponent implements OnChanges {
3326 /**
3427 * The search query
3528 */
@@ -88,7 +81,7 @@ export class SearchFormComponent implements OnInit {
8881 /**
8982 * Retrieve the scope object from the URL so we can show its name
9083 */
91- ngOnInit ( ) : void {
84+ ngOnChanges ( ) : void {
9285 if ( isNotEmpty ( this . scope ) ) {
9386 this . dsoService . findById ( this . scope ) . pipe ( getFirstSucceededRemoteDataPayload ( ) )
9487 . subscribe ( ( scope : DSpaceObject ) => this . selectedScope . next ( scope ) ) ;
@@ -122,19 +115,12 @@ export class SearchFormComponent implements OnInit {
122115 updateSearch ( data : any ) {
123116 const queryParams = Object . assign ( { } , data ) ;
124117
125- this . router . navigate ( this . getSearchLinkParts ( ) , {
118+ void this . router . navigate ( this . getSearchLinkParts ( ) , {
126119 queryParams : queryParams ,
127120 queryParamsHandling : 'merge'
128121 } ) ;
129122 }
130123
131- /**
132- * For usage of the isNotEmpty function in the template
133- */
134- isNotEmpty ( object : any ) {
135- return isNotEmpty ( object ) ;
136- }
137-
138124 /**
139125 * @returns {string } The base path to the search page, or the current page when inPlaceSearch is true
140126 */
0 commit comments