1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 17:59:37 +02:00

Fix reloading table data

This commit is contained in:
Chocobozzz 2025-09-15 14:07:23 +02:00
parent 4888717c09
commit 42e0c015e8
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 16 additions and 4 deletions

View file

@ -1,4 +1,4 @@
import { NgClass, NgIf } from '@angular/common'
import { CommonModule, NgClass } from '@angular/common'
import { Component, OnInit, inject, output, viewChild } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { Notifier, ServerService } from '@app/core'
@ -16,7 +16,7 @@ import { REGISTRATION_MODERATION_RESPONSE_VALIDATOR } from './process-registrati
@Component({
selector: 'my-process-registration-modal',
templateUrl: './process-registration-modal.component.html',
imports: [ NgIf, GlobalIconComponent, FormsModule, ReactiveFormsModule, NgClass, PeertubeCheckboxComponent, AlertComponent ]
imports: [ CommonModule, GlobalIconComponent, FormsModule, ReactiveFormsModule, PeertubeCheckboxComponent, AlertComponent ]
})
export class ProcessRegistrationModalComponent extends FormReactive implements OnInit {
protected formReactiveService = inject(FormReactiveService)

View file

@ -45,6 +45,8 @@ export type TableQueryParams = {
sortOrder?: number
sortField?: string
search?: string
state?: number
}
export type TableColumnInfo<ColumnName> = {
@ -250,7 +252,7 @@ export class TableComponent<Data, ColumnName = string, QueryParams extends Table
if (sort) this.sort = sort
this.resetPagination()
this.updateUrl()
this.updateUrl({ reset: true })
}
private resetPagination () {
@ -379,7 +381,11 @@ export class TableComponent<Data, ColumnName = string, QueryParams extends Table
this.loadData()
}
private updateUrl () {
private updateUrl (options: {
reset?: boolean
} = {}) {
const { reset = false } = options
const newParams: TableQueryParams = {
...this.route.snapshot.queryParams,
...this.customUpdateUrl()(),
@ -391,6 +397,12 @@ export class TableComponent<Data, ColumnName = string, QueryParams extends Table
sortField: this.sort.field
}
if (reset) {
const baseState = this.route.snapshot.queryParams.state || 0
newParams.state = +baseState + 1
}
debugLogger('Update URL', { newParams })
this.peertubeRouter.silentNavigate([ '.' ], newParams, this.route)