Skip to content

Maximum update depth exceeded after value change Deep Copy problem #771

Open
@MuhammedAlmaz

Description

@MuhammedAlmaz

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.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions