If I have 5 different lightning components in my lightning page, how do they load? Are they all loading at the same time, asynchronsouly?

Is there a way to control which loads first, second, third, etc...?


  • 1
    What's your actual question, though? Why do you need to control the order of loading? Please read about what an X-Y Problem is, then edit your question to include your use case, any problems you're experiencing, etc. – sfdcfox Mar 23 '19 at 2:54
  • The question is basically, how does the lightning components load on the page? Do they load all at the same time when the page loads, does it load chronologically? Just a straight forward question, sorry if it doesn't make sense... – Peter Hoang Mar 23 '19 at 3:07

Starting from the documentation, the general idea is that the app container is loaded first, parent components are loaded next, then child components are recursively loaded back up to the parent components. As far as initialization goes, children are initialized before their parents, but after attribute propagation. Aside from ordering your source code, there's no way to control markup-generated component initialization. If you want to control the order better, you could use $A.createComponents to encourage a specific load order, but this has performance implications. Also note that aura:if renders asynchronously as well, so using aura:if can result in other components loading out of order.

| improve this answer | |

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.