Skip to main content

Posts

Featured

Looping of Asynchronous/Apex calls from LWC components

 Many a times we see use cases where based on an event we would need to make multiple apex calls. While it is easy to handle fixed no of calls to different methods with Promise.all() there is no specific solution use case where we need to make random number of calls based on a condition to the same apex method. Below we see one such simple sample use case The below example keeps on doing async class until it meets one if the exit conditions either 50 contacts are fetched or a contact with Josh Davis Name is fetched. as this is loop of async calls on the ui we can clearly see contacts showing up one by one with a gap of 2 seconds. < template >     < lightning-card title = "ApexImperativeMethod" icon-name = "custom:custom63" >         < div class = "slds-m-around_medium" >             < p class = "slds-m-bottom_small" >                 < lightning-button label = "Load Contacts"                            

Latest posts

Streaming API for Community 'n' Internal, Platform Events subscription using CometD

LWC Visual Pickers

Lightning Web Components Quick Action workaround - highly flexible

Sneaky smart Quick Action to open record create, edit or like pages/panels for an object