2

The documentation on server-side queuing does not explicitly state whether each action gets its own execution context. Neither do the docs on Apex Transaction. The Trailhead on execution context sides lightning actions with visualforce but does not mention them again.

I was researching the Apex Singleton Pattern (here, here, and here) initially since many of my components need to query for the same config/setup settings. This got me wondering if there was a use case in lightning. Which lead to this question about execution context / queuing of lightning actions.

3

To answer your question, all aura enabled methods are static in nature and hence have their own distinct execution context. For more information, refer documentation for apex server side controller documentation (https://developer.salesforce.com/docs/atlas.en-us.208.0.lightning.meta/lightning/controllers_server_apex.htm?search_text=AuraEnabled)

I believe what you are looking for is Storable Actions. Storable actions, allow us to cache known data retrievals and avoid making multiple server calls for same request.

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.