1

There seems to be a confusion around this subject on my team, maybe you can help us clear it. Does aura:if go to the server when called? Common sense says it doesn't, but the component documentation says: "aura:if evaluates the isTrue expression on the server and instantiates components in either its body or else attribute." https://developer.salesforce.com/docs/component-library/bundle/aura:if/documentation

Anyone has a conclusive thought on this?

Thank you, Eran

1
  • 2
    P.S. I also sent out a Tweet asking for clarification on the topic. Stay tuned.
    – sfdcfox
    Oct 1, 2020 at 14:03

1 Answer 1

1

This documentation is not correct. I wrote a simple Lightning App, loaded it in my browser, then disconnected my WiFi. It still toggled correctly even without any connection. However, be aware that components are not in the DOM, so if they are not yet in the Lightning Component Cache, a server trip is still required.

2
  • At which point are components in the cache? After toggling between both true and false?
    – EranV
    Oct 1, 2020 at 14:05
  • @EranV The first time they are instantiated. This could be either dynamic via $A.createComponents, static via aura:dependency, or when they are rendered by a template (e.g. as you say, when switching from true to false). Once they've been loaded once, they will continue to work until the cache is invalidated.
    – sfdcfox
    Oct 1, 2020 at 14:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .