Which force:* events must I declare as

I’m confused when to use <aura:dependency resource="force.."> and when not?

If my component is using on of the following system events does it need to be explicitly declared as dependency?

  • force:closeQuickAction
  • force:createRecord
  • force:navigateToSObject
  • force:showToast

I remember having read that system events are somewhat autodiscovered but in some open source repos (e.g. Strike Components) I found components declaring them explicitly.

Answer

The system automatically detects a component’s dependencies through several mechanism and ensures they’re available on the client when it needs them.

<aura:dependency> is for advanced use cases where you need explicit control over prefetching of definitions. Using this effectively requires careful consideration and performance analysis.

I highly recommend not using them until you have a clear data-based need to control definition prefetching.

Attribution
Source : Link , Question Author : Robert Sösemann , Answer Author : Kevin Venkiteswaran

Leave a Comment