[Solved] Vue Template Error: You may have an infinite update loop in a component render function,vue

The reason for my error report is:

I used sort to sort the values defined in data. Data detected changes and re rendered the template, resulting in repeated circular rendering, which gave me a warning (which also led to abnormal paging rendering)

{{ scope.row.jobs.sort((a,   b)=>   new   Date(a.createdAt)  –  new   Date(b.createdAt))[0].createdAt   }}

Solution:

Sort works on itself, so I made a deep copy in sort.

{{   JSON.parse(JSON.stringify(scope.row.jobs)).sort((a,   b)=>   new   Date(a.createdAt)  –  new   Date(b.createdAt))[0].createdAt   }}

Similar Posts: