lodash.clonedeep Maximum call stack size exceeded
时间: 2023-10-30 18:02:28 浏览: 259
The error message "Maximum call stack size exceeded" typically occurs when there is an infinite recursion or a very deep recursive function call. It means that the function is calling itself too many times, exhausting the call stack and causing the error.
In the case of `lodash.clonedeep`, it is a recursive function that deep clones an object. This error can occur if you have a circular reference in your object, meaning an object that references itself at some point.
To fix this issue, you can try to identify and resolve any circular references in your object. Alternatively, you can use a different approach to cloning objects, such as using `JSON.parse(JSON.stringify(obj))` or other libraries like `immer` or `rfdc` that handle cloning without the risk of exceeding the call stack size.
阅读全文