Currently working with arrays of objects of arrays of objects and filtering those lists to generate new lists, but do not want to mutate the original list.
To do this, I clone the data, and in plain javascript I easily accomplish this with structedClone()
. See JS fiddle: https://jsfiddle.net/vhekqx2a/
const items = [
{"name": "one", list: [{'name': 'listItemOne'}]},
{"name": "two", list: [{'name': 'listItemOne'}]},
];
//DEEP CLONE
const itemsDeepClone = structuredClone(items);
MDN: https://developer.mozilla.org/en-US/docs/Web/API/structuredClone
However, when I attempt to use this in an LWC, I get the following error:
[structuredClone is not a function]
Can someone explain what it is about LWC that makes this function not available? Is it due to lightning locker service?