Title: Setting sort in onLazyLoad event triggers infinity loop on p-table
Tags: angular;primeng;p-table
Question: I'm new to Angular and getting a Issue at the PrimeNG p-table.
This is my p-table
<p-table [value]=&quot;data&quot; [lazy]=&quot;true&quot; (onLazyLoad)=&quot;loadData($event)&quot; [multiSortMeta]=&quot;sort&quot; .... &gt;
When anything changes I come in my loadData Method.
loadData(event): void {
this.dataservice.loadData(..fields from event...).subscribe(result =&gt; {
this.data = result.data;
this.sort = result.sort; // <- This run into infinity loop
})
So everytime I change this.sort I am coming into my loadData which will again do a request and so on.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2021:00:03/11/21', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<angular><primeng><p-table>', 'Title': 'Setting sort in onLazyLoad event triggers infinity loop on p-table', 'ViewCount': 223, 'id': 66589349, 'user_AboutMe': None, 'user_AccountId': 7638596.0, 'user_DisplayName': 'Punching', 'user_Reputation': 45.0, 'user_Views': 18.0, 'user_id': 5791432.0}}