Is there a way to have access to data from Apex immediately when the lightning component is loading? I know that in the early days of Lightning Components I was able to do it with an Apex Model. However, I believe that concept never made it into the final, released version of Lightning Components.
Right now my best way of getting data into my components from Apex is through an init handler in my component that invokes an action. This seems a bit slow because I have to do another round trip to Salesforce to get my data.
Am I missing something simple, or is the init handler approach the correct way. Also as a side node, is the concept of "Models" totally gone from Lightning Components? I did see a small reference to them in the documentation, but that could be a remnant from older documentation.
Below is my network console from Chrome when I'm loading up a Lightning App.
The first green line "Test.app" is the first response from the browser and took 1.83 seconds. This loads up the Lightning Components runtime. The second green line is my app and components loading and took 1.96 seconds. Once this is finished, finally my init handler is run and I am able to make a request to one of my Apex Controller functions and get data back. I understand that the 4.22 seconds there is my code and I'm responsible for the performance there.
Is it truly the case that 4 seconds will pass loading up Lightning Components before I can even start running my Apex code, or is there a way to maybe get data back from the Test.app request or the first aura xhr request?