After spring 20 release update in my sandbox i'm finding that non-cached apex response object cannot be extended and the lwc controller is throwing exception "Cannot add a property x, object not extensible".
I believe after spring 20, the controller runs in strict mode where you can't extend the response object. I can get away from this by cloning the object. eg. let data = { ...result}. Not sure if this is going to break in future.
Again, this cloning gets applied only to the top level object, if there are object inside an object, this doesn't work. In that case stringifying the response will fix, but again this is not mentioned in anywhere.
We have lwc code deployed to production with object extensions and will break once this update gets into production.
Does anyone face the same issue? Any suggestions
UPDATE: I find this is inconsistent behavior, some of the existing components with api version 46 works with object extension. I guess this is a bug.
Just to clarify on apex controller, i'm not using any cachable methods but an @AuraEnabled method. I believe this is not cached and hence the response should be editable.
As i said, this was working before spring 20 and but now it has put more restriction on the client side controller irrespective of the api version, which is quiet annoying.