Merge pull request #2361 from nona-luypaert/issue-2337_fix-vocabulary-treeview-not-updating

Fix tree not updating when switching between "Browse by Vocabulary" pages
This commit is contained in:
Tim Donohue
2023-09-05 17:14:23 -05:00
committed by GitHub
2 changed files with 13 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
import { FlatTreeControl } from '@angular/cdk/tree';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, OnChanges, SimpleChanges } from '@angular/core';
import { map } from 'rxjs/operators';
import { Observable, Subscription } from 'rxjs';
@@ -28,7 +28,7 @@ import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operato
templateUrl: './vocabulary-treeview.component.html',
styleUrls: ['./vocabulary-treeview.component.scss']
})
export class VocabularyTreeviewComponent implements OnDestroy, OnInit {
export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges {
/**
* The {@link VocabularyOptions} object
@@ -322,4 +322,9 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit {
private getEntryId(entry: VocabularyEntry): string {
return entry.authority || entry.otherInformation.id || undefined;
}
ngOnChanges(changes: SimpleChanges): void {
this.reset();
this.vocabularyTreeviewService.initialize(this.vocabularyOptions, new PageInfo(), this.selectedItems, null);
}
}

View File

@@ -782,6 +782,8 @@
"browse.comcol.by.srsc": "By Subject Category",
"browse.comcol.by.nsi": "By Norwegian Science Index",
"browse.comcol.by.title": "By Title",
"browse.comcol.head": "Browse",
@@ -804,6 +806,8 @@
"browse.metadata.srsc.breadcrumbs": "Browse by Subject Category",
"browse.metadata.nsi.breadcrumbs": "Browse by Norwegian Science Index",
"browse.metadata.title.breadcrumbs": "Browse by Title",
"pagination.next.button": "Next",
@@ -2826,6 +2830,8 @@
"menu.section.browse_global_by_srsc": "By Subject Category",
"menu.section.browse_global_by_nsi": "By Norwegian Science Index",
"menu.section.browse_global_by_title": "By Title",
"menu.section.browse_global_communities_and_collections": "Communities & Collections",