I have some
Apex calls I would like to run in the background from a
Lightning Web Component. Looking into the "correct" way to do so, I haven't found much concrete information. I see Aura had Foreground and Background Actions, which meant you could call
Lightning Web Components seem to be lacking in feature parity here. The corresponding documentation in the
Lightning Components Developer’s Guide actually just describes how it works in Aura, as far as I can tell. It also mentions at the very bottom:
To mark a server-side action as a background action in Java, use the
@BackgroundActionannotation at the method level on the controller.
But A) it's
Java, and B) that annotation does not exist.
What are my options? It seems like
setTimeout(myApex, 0) might work, but is a bit hacky and recommended against. I'm also not sure if those calls will still block the UI or not. Are there any supported alternatives? Is that the "canonical" approach?