Fixed an issue where the albums we not reloading when navigating to a different artist

pull/3895/head
Jamie Rees 5 years ago
parent 12a80c7903
commit 982455bc4e

@ -1,6 +1,7 @@
import { Component, Input, ViewEncapsulation, OnInit } from "@angular/core";
import { IReleaseGroups } from "../../../../../interfaces/IMusicSearchResultV2";
import { SearchV2Service } from "../../../../../services/searchV2.service";
import { ActivatedRoute } from "@angular/router";
@Component({
templateUrl: "./artist-release-panel.component.html",
@ -14,9 +15,20 @@ export class ArtistReleasePanel implements OnInit {
public albums: IReleaseGroups[];
constructor(private searchService: SearchV2Service) { }
constructor(private searchService: SearchV2Service, private route: ActivatedRoute) {
route.params.subscribe(() => {
// This is due to when we change the music Id, NgOnInit is not called again
// Since the component has not been destroyed (We are not navigating away)
// so we need to subscribe to custom changes so we can do the data manulipulation below
this.loadAlbums();
});
}
public ngOnInit() {
this.loadAlbums();
}
private loadAlbums(): void {
this.albums = this.releases.filter(x => x.type === "Album");
this.albums.forEach(a => {

Loading…
Cancel
Save