Skip to content

Commit

Permalink
Merge pull request #24936 from qmonmert/fix/24925
Browse files Browse the repository at this point in the history
[Angular] Using Entity 'Refresh list' button makes pagination links multiply requests
  • Loading branch information
DanielFran authored Jan 23, 2024
2 parents 01c2668 + 6a16637 commit 77657db
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { Component, inject, OnInit } from '@angular/core';
import { HttpHeaders } from '@angular/common/http';
<%_ } _%>
import { ActivatedRoute, Data, ParamMap, Router, RouterModule } from '@angular/router';
import { combineLatest<%_ if (!readOnly) { _%>, filter<%_ } _%>, Observable, switchMap, tap } from 'rxjs';
import { combineLatest<%_ if (!readOnly) { _%>, filter<%_ } _%>, Observable, switchMap, Subscription, tap } from 'rxjs';
<%_ if (!readOnly) { _%>
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
<%_ } _%>
Expand Down Expand Up @@ -121,6 +121,7 @@ export class <%= componentName %> implements OnInit {
private static readonly NOT_SORTABLE_FIELDS_AFTER_SEARCH = [<%- notSortableFieldsAfterSearch %>];

<%_ } _%>
subscription: Subscription | null = null;
<%= entityInstancePlural %>?: I<%= entityAngularName %>[];
isLoading = false;

Expand Down Expand Up @@ -227,7 +228,10 @@ export class <%= componentName %> implements OnInit {

<%_ } _%>
load(): void {
this.loadFromBackendWithRouteInformations().subscribe({
if (this.subscription !== null) {
this.subscription.unsubscribe();
}
this.subscription = this.loadFromBackendWithRouteInformations().subscribe({
next: (res: EntityArrayResponseType) => {
this.onResponseSuccess(res);
}
Expand Down

0 comments on commit 77657db

Please sign in to comment.