Skip to content

Error when binding value is modified in parent components init handler #83

@sankaran1984

Description

@sankaran1984

Describe the bug
I am seeing an error when the binding value is modified in the parent component's init handler.

To Reproduce

  1. create a test lightning App

Testapp.app

<aura:application extends="force:slds">
	<aura:attribute name="buttonLabel" type="String" default="Neutral"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.initHandler}"/>    

    <!-- create following button component using Force-DI -->
    <!-- <lightning:button label="Neutral"></lightning:button> -->   
    <c:di_injector bindingName="lc_button">
        <c:di_injectorAttribute name="label" value="{!v.buttonLabel}"/>
    </c:di_injector>
</aura:application>

TestappController.js

({
	initHandler : function(cmp, evt, helper) {
		cmp.set('v.buttonLabel', 'brand');
	}
})
  1. create custom metadata
    di_Binding.lc_button
<?xml version="1.0" encoding="UTF-8"?>
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <label>lc_button Binding</label>
    <protected>false</protected>
    <values>
        <field>BindingObjectAlternate__c</field>
        <value xsi:nil="true"/>
    </values>
    <values>
        <field>BindingObject__c</field>
        <value xsi:nil="true"/>
    </values>
    <values>
        <field>BindingSequence__c</field>
        <value xsi:nil="true"/>
    </values>
    <values>
        <field>To__c</field>
        <value xsi:type="xsd:string">lightning:button</value>
    </values>
    <values>
        <field>Type__c</field>
        <value xsi:type="xsd:string">LightningComponent</value>
    </values>
</CustomMetadata>

Steps to reproduce the behavior:

  1. Create a scratch org & deploy force-di package
  2. create lightning app & custom metadata as mentioned
  3. preview the app - /c/Testapp.app

Expected behavior
No error expected.

Screenshots and text of error observed
image

Version
Did you try to reproduce the problem against the latest force-di code? yes

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions