4

We have hit a blocking problem while updating our codebase to support the LockerService. The steps to reproduce are:

  1. Component reads an sObject from Apex using the normal aura action/boxcar service
  2. User modifies two fields (one which was present in the SObject because it was queried and one which was not present but is a valid field for that SObject)
  3. This object is sent back to Apex to be saved but...
  4. The field which was absent in the loaded SObject does not appear in the Apex debug log but the other changed field is present

This problem only occurs with LockerService enabled.

Debugging the javascript, it appears that new values in objects are not stored in quite the same way as values received from Apex during page load.

This seems like a bug or is there a new way to set values in objects before sending them to Apex with LockerService enabled? Or maybe it's a bug in the serialisation of the data when sent back to Apex?

I can't find any examples of this in the documentation.

Thanks in advance for your help...

6
  • 1
    Ha, you have run into the same problem as me (I think)...salesforce.stackexchange.com/questions/156539/… - I ended up having to set all unqueried values. My issue was with properties but the queried values have the same symptom. makes input components essentially useless. I also had to stringify all data sent back to apex.... – Eric Feb 2 '17 at 1:52
  • Thanks for the moral support Eric. I'm hoping that there is an official answer for this because I can't imagine new values not being supported. You do raise a possible workaround though, that's send all data as stringified JSON and re-hydrated in Apex. It's ugly but it would work. – Steve Buikhuizen Feb 2 '17 at 2:33
  • I noticed this issue as well. This lead me down the path of handling serialization/deserialization myself. A bit more overhead, but I've not had this issue since. – Antonio Manente Feb 2 '17 at 6:00
  • 1
    @SteveBuikhuizen We have a bug for this issue. Another similar discussion on this thread and you can see Trevor Bliss' comment which has a workaround. If you open a Salesforce support case, you can provide them W-3221032 as the bug number to attach it to. – Ravi Jayaramappa Feb 2 '17 at 19:05
  • @RaviJayaramappa thanks. Can you provide a link to the discussion so I can see the work-around? – Steve Buikhuizen Feb 2 '17 at 22:11
1

The fix for this issue is currently scheduled for the Summer '17 release. LockerService will utilize Proxy objects to properly update the shape of previously defined objects. This will make the parse/stringify workaround linked in the comments unnecessary and fix a few other closely related issues.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.