5

i just observed summer 19 release notes, and in my org critical updates area, we r using $A.createComponent()/ $A.createComponents() in bunch of our custom lightning cmps's. still i am not under stand how this critical updates 'll effects of our orgs, can you please explain how it'll effects for below code snippet.

we r using simple like below:

cmpcontroller.js

opencustomcmpmodal: function(component,field1,field2,field3){ 
var attributes = {
   'chldfield1': field1,
   'chldfield2': field2,
   'chldfield3': field3
};

    $A.createComponents(
                [
                    ["aura:html", {
                        "tag": "h2",
                        "body": 'Modal header',
                        "HTMLAttributes": { 
                            "class": "slds-text-heading_medium slds-hyphenate" 
                        }
                    }],
                    ["c:mycustomcomponent",attributes]
                ],
            function(components, status) {
                if (status === "SUCCESS") {
                    modalheader = components[0];
                    modalBody = components[1];
                   var promiseaction =  component.find('overlayLib').showCustomModal({
                       header:modalheader,
                        body: modalBody,
                        showCloseButton: true,
                        cssClass: "my-modal,my-custom-class,my-other-class"
                    });
                    component.set("v.modalPromise",promiseaction);
                }
            });
} 

1 Answer 1

7

The critical update applies only if your attributes used in have a function expression $A.createComponent/$A.createComponents

Lets say your attribute definition was as below

var attributes = {
  'chldfield1': field1,
  'chldfield2': function (x,y) { console.log('test')},
  'chldfield3': field3
};

The above assumes your component has an attribute of type "FUNCTION" like below

<aura:attribute name="chldfield2" type="Function" />

Notice that the chldfield2 has a function expression, this is where you will need to be worried and will test your component with critical update on.

If you do not have components with attribute as function you should be unaffected by this update.

However i suggest you enable this and test your component.

Also critical updates are mostly reversible for short span of time so you can always deactivate them until it is applied permanently.

3
  • 1
    thank you for very detailed info, i am going to activate and test our code base. i'll post if any issues
    – sdandamud1
    Commented Sep 20, 2019 at 17:27
  • is this also applicable if you have the attribute type as "Aura.Action"? Commented Jan 10, 2020 at 15:17
  • Not tested it and nothing mentioned in docs.I suggest you do a poc with critical update on Commented Jan 10, 2020 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .