devextreme-react icon indicating copy to clipboard operation
devextreme-react copied to clipboard

Maximum update depth exceeded after value change Deep Copy problem

Open MuhammedAlmaz opened this issue 1 year ago • 2 comments

When value change after onValueChanged callback function, if we deep copy the new value and set this new value to value parameter of TagBox, onValueChanged function trigger infinity. How can i solve this problem? I have one global component and i'm changing the value everytime from props. Why you are not checking keys and compare two values? You can check it and if there was any diff from two value and trigger onValueChanged function. I'm pretty sure it is not really good way to check diff between two values. You guys checking only adress of the variable not arrays.

The code example here you can check.

https://codesandbox.io/s/overview-devextreme-tag-box-forked-gro4hm

If i change the line from this.setState({ ...this.state,selectedValues: [...e.value] }); to this.setState({ ...this.state,selectedValues: e.value });

it will work. But we are using different variables and the values address changing. So there is a big problem as i said before.

MuhammedAlmaz avatar Oct 12 '22 11:10 MuhammedAlmaz

Any update for this?

MuhammedAlmaz avatar Oct 31 '22 14:10 MuhammedAlmaz

Hi @MuhammedAlmaz

I don't see TagBox in your example. Could you please double-check the link?

artem-kurchenko avatar Nov 08 '22 07:11 artem-kurchenko