Avoid Using Map Objects
Use of the Map object with Lightning Web Security (LWS) enabled can run into issues when the object is serialized. Instead of using a Map instance, you can use a plain JavaScript object in most cases.
If you must use maps, use the set()
method to insert key-value pairs instead of adding custom properties. If the data passed in Map must be serialized, pass a custom replacer function to JSON.stringify(...)
.
Using maps in Lightning web components isn’t supported for both imperative and wired Apex calls.
See Also