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

Immutable data: failed on update #3590

Closed
scilganon opened this issue Dec 27, 2019 · 9 comments
Closed

Immutable data: failed on update #3590

scilganon opened this issue Dec 27, 2019 · 9 comments

Comments

@scilganon
Copy link

[x] bug report => see 'Providing a Reproducible Scenario'
[] feature request => do not use Github for feature requests, see 'Customers of ag-Grid'
[] support request => see 'Requesting Community Support'

Providing a Reproducible Scenario

Accepted reproducible scenarios are:

  • create grid with ag-grid-react
  • bind immuted data with immer
  • update one row with immer

Current behavior

Got error:

TypeError: Cannot add property areEquivPropertyTracking, object is not extensible

Expected behavior

detection changes mechanism should not mutate original data, like this

Please tell us about your environment:

  • ag-Grid version: 22.1.1

  • ag-Grid-react version: 22.1.1

  • Browser: Google Chrome 79.0.3945.88

  • Language: TypeScript 3.5

@scilganon
Copy link
Author

let me know, if you need more details

@benhodeda
Copy link

hi :)
I had a similar problem when I've migrated our state object to use immer instead of immutableJS .
We bind the state to AgGridReact's rowData prop, and when we filter the data (server-side filtering) the app was crash while doing change detection. I added deltaRowDataMode prop alongside with getRowNodeId={row => row.id} on AgGridReact component.

you can read more here: https://www.ag-grid.com/javascript-grid-data-update/

@seanlandsman
Copy link
Member

Hi

@benhodeda has provided the answer here - thanks for that

@don-motorefi
Copy link

This answer did not resolve the issue for me.

We are using the io-ts library, which provides advanced typing support, and by default creates all objects as readonly. With this, when I provide an array of such objects to an <AgGridReact> component, the grid crashes after a few seconds, presumably when it's running some change detection, with the error:

TypeError: Cannot add property areEquivPropertyTracking, object is not extensible

I have already had the deltaRowDataMode: true property set, and have a custom getRowNodeId function. Are there any other solutions for this?

@gadld
Copy link

gadld commented Aug 18, 2020

This answer did not resolve the issue for me.

We are using the io-ts library, which provides advanced typing support, and by default creates all objects as readonly. With this, when I provide an array of such objects to an <AgGridReact> component, the grid crashes after a few seconds, presumably when it's running some change detection, with the error:

TypeError: Cannot add property areEquivPropertyTracking, object is not extensible

I have already had the deltaRowDataMode: true property set, and have a custom getRowNodeId function. Are there any other solutions for this?

I had the same problem, I stopped using immer for my state. And used good old fashion updates

@rahulseth625
Copy link

This answer did not resolve the issue for me.

We are using the io-ts library, which provides advanced typing support, and by default creates all objects as readonly. With this, when I provide an array of such objects to an <AgGridReact> component, the grid crashes after a few seconds, presumably when it's running some change detection, with the error:

TypeError: Cannot add property areEquivPropertyTracking, object is not extensible

I have already had the deltaRowDataMode: true property set, and have a custom getRowNodeId function. Are there any other solutions for this?

If you have find the solution then pls reply

@doarrison
Copy link

I ran into this problem and found that in my case it was due to immer data passed as params to custom CellEditors. It looks like grid uses the default change tracking on the props/params to see if the custom components needed to refresh hence causing the error.

@shubhank-srivastava
Copy link

deltaRowDataMode has been renamed to immutableData in Ag Grid version 23.1.0 onwards. See the changelogs for more - https://www.ag-grid.com/ag-grid-changelog/

Also, if you are using immer, you might want to call setAutoFreeze(false) as immer freezes the state tree that it produces. More here - https://immerjs.github.io/immer/freezing

@DAVIDSUSAIRAJ
Copy link

DAVIDSUSAIRAJ commented Aug 29, 2022

I applied immutable data and getRowNodeId. This is working fine. But if the same name in the first column automattically created one row. Why is happening?What is the reason? Anybody can help me..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants