I'm working on making my lightning components compliant with Locker Service, and I see something strange happens with javascript variables after calling component.set()
on them.
A component is having an attribute:
<aura:component controller="CPQ_QOT02_ConfigurationLC" access="GLOBAL">
...
<aura:attribute name="item" type="Object" access="GLOBAL"/>
...
</aura:component>
In the init
method of controller I'm calling server to fetch item
variable. Item is a complex JS object having several properties (maps and arrays). Response from server is ok, I'm handling it in helper
in below lines:
line code
126 if (response.status == "SUCCESS") {
127 var item = JSON.parse(response.data);
128 console.log(item);
129 component.set("v.item", item);
130 console.log(component.get("v.item"));
131 ...
There is a significant difference between console.log
that is printed to console in line 128 (before calling set) and in line 130 after calling it.
Here are snapshots from the browser console:
Console.log
from line 128:
Console.log
from line 130 (after setter was called. Looks like all properties are not directly visible):
As a result - whatever I would do later with the "v.item"
variable - it seems not being applied to that attribute. Before locker service, everything was working fine, but also the result of both console.log's were the same.
Am I doing something wrong, or this is some framework issue?