fix(client/PluginPages): reload component upon URL change

pull/6218/head
kontrollanten 2024-03-31 08:23:28 +02:00
parent 581bc1e13a
commit ed70cc5ed5
1 changed files with 13 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { MetaService, PluginService } from '@app/core'
import { logger } from '@root-helpers/logger'
import { Subscription } from 'rxjs/internal/Subscription'
@Component({
templateUrl: './plugin-pages.component.html',
@ -10,6 +11,8 @@ import { logger } from '@root-helpers/logger'
export class SharedPluginPagesComponent implements AfterViewInit {
@ViewChild('root') root: ElementRef
private urlSub: Subscription
constructor (
private metaService: MetaService,
private route: ActivatedRoute,
@ -19,9 +22,16 @@ export class SharedPluginPagesComponent implements AfterViewInit {
}
ngAfterViewInit () {
this.pluginService.ensurePluginsAreLoaded(this.route.snapshot.data.pluginScope || 'common')
.then(() => this.loadRoute())
async ngAfterViewInit () {
await this.pluginService.ensurePluginsAreLoaded(this.route.snapshot.data.pluginScope || 'common')
this.urlSub = this.route.url.subscribe(() => {
this.loadRoute()
})
}
ngOnDestroy () {
if (this.urlSub) this.urlSub.unsubscribe()
}
private loadRoute () {