I have a code that calls specific components upon clicking links. These components have init functions that checks certain field values. I'd like to know how many times an init function is called since I wanted it to always perform everytime the component is called.

I added an alert inside the init function of a component and while it is true that it alerts everytime the page is loaded as it is the default component to be loaded, once I click a link and another component loads, then click a new link to load the previous one, the init function does not execute and the alert is gone. I know we have the renderer to fix this kind of stuffs but I wanted to know if we could do it in the init function.

  • This is an X-Y problem. You're trying to fix something else, and believe that "init" is the proper way to handle it, but it's not. Try asking your original question so that we may better assist you.
    – sfdcfox
    Commented Aug 7, 2017 at 11:13

1 Answer 1


No you can't do that init.

Init is called only when component is initiated/loaded. Second time when you click on the link then behind the scene the component is not loaded it is cached already in the first call that's the reason second time init is not called.

This is the designed behavior of framework.

You must log in to answer this question.