You need to sign in to do that
Don't have an account?
Bobby Knezevic
Component initializer called twice
Hello, there. I'm working on very first Lightning application, and I'm noticing some strange behavior. I'm using a VF page with <apex:includeLightning /> and a script to load a component from an app like so:
When I load up the VF page, I get a debug to the console that the component has finished loading (as expected). However, I get two separate, but identical, log messages with the action result. Why are two calls made to the server??
Thanks so much. =)
$Lightning.use("c:OpportunityProductApp", function() { $Lightning.createComponent("c:PricebookSelector", {}, "pricebookSelector", function(cmp) { console.log('loaded component ...'); // do some stuff here }); });The Lightning application is very simple:
<aura:application access="GLOBAL" extends="ltng:outApp"> <c:PricebookSelector /> </aura:application>The lightning component is as equally simple:
<aura:component controller="PricebookSelectorController"> <aura:attribute name="pricebooks" type="List" /> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> </aura:component>The component controller looks like this:
({ doInit : function(component, event, helper) { helper.getPricebooks(component); } })Finally, the component helper looks like this:
({ getPricebooks: function(component) { var action = component.get("c.getPricebooks"); var self = this; action.setCallback(this, function(actionResult) { console.log(actionResult); }); $A.enqueueAction(action); } })The problem:
When I load up the VF page, I get a debug to the console that the component has finished loading (as expected). However, I get two separate, but identical, log messages with the action result. Why are two calls made to the server??
Thanks so much. =)
with:
All Answers
with:
Thanks for your help! =)
labreports.upcovid19tracks.in (https://www.gorakhpurhindinews.com/online-labreports-upcovid19tracks-in/)