Uncaught TypeError: 'set' on proxy: trap returned falsish for property Name
Cached items are set as read-only (because otherwise you could corrupt the cache). If you want a modifiable object, you need to clone it.
this.wiredContact = Object.assign({}, data);
Based on comments, you can also use the rest parameter syntax in LWC:
this.wiredContact = {...data};
This is what I could find from the documentation for wired service and that seems to be the case here (emphasis mine).
The wire service provisions an immutable stream of data to the component
So it most likely seems that when trying to set the values directly using this.wiredContact.Name
, because of it's read only property, the values are not getting set.
However if you try to create a new data and then assign it to this.wiredContact
, it works:
this.wiredContact = "{Name:" + event.detail.value + "}";
For nested Objects I use two recursive functions :
const setNestedKey = (obj, path, value) => {
if (path.length === 1) {
obj = {...obj, [path] : value}
return obj
}
return setNestedKey(obj[path[0]], path.slice(1), value)
}
const assignObject = (obj, path, value) => {
let newObj = setNestedKey(obj, path, value);
if (path.length === 1) {
return newObj;
}
path.pop();
return assignObject(obj, path, newObj);
}