Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem of Object equality checks with frozen objects #4600

Closed
Cito opened this issue Dec 3, 2017 · 1 comment
Closed

Problem of Object equality checks with frozen objects #4600

Cito opened this issue Dec 3, 2017 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@Cito
Copy link
Contributor

Cito commented Dec 3, 2017

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap

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.

  • Angular version: 5.0.5
  • 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.

@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Dec 19, 2017
@cagataycivici cagataycivici added this to the 5.1.0-M1 milestone Dec 19, 2017
@cagataycivici cagataycivici changed the title Problem when using DataTable with data loaded via Apollo GraphQL client ("object is not extensible" error) Problem of Object equality checks with frozen objects Dec 25, 2017
@cagataycivici cagataycivici self-assigned this Dec 25, 2017
@cagataycivici
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants