Problem of Object equality checks with frozen objects #4600
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
http://plnkr.co/jCwS5OadJK7KHP0wptat
Current behavior
When you load data via the Apollo GraphQL client and use it for a selectable DataTable that has no dataKey set, you get an error "Cannot add property _$visited, object is not extensible" when selecting rows.
Expected behavior
There should be no error, like with data loaded from other sources or when setting a dataKey.
Minimal reproduction of the problem with instructions
see Plunkr case above
What is the motivation / use case for changing the behavior?
I want to display data loaded with the Apollo Client for GraphQL directly in a PrimeNG DataTable.
PrimeNG version: 5.0.2
Browser: Chrome, Edge, Firefox
Language: TypeScript 2,4
Analysis of the Problem:
The problem is caused by Apollo Client returning "deep-frozen" query results in test and development. Particularly, no new properties can be added to these objects.
However, when there is no dataKey set on a DataTable, PrimeNG tries to compare rows using its
objectUtils.equals()
method. This method tries to set a_$visited
property on the examined objects, which does not work when the objects are frozen.The text was updated successfully, but these errors were encountered: