On my account detail VF page, I have added 5 custom related lists. 3 of those related lists have <apex:actionfunction>
in the component code. I found out that the constructors of these components are getting called twice. The constructors of the other 2 related lists are not getting called twice. I researched and found two useful links: link 1 & link 2.
The solution would be to use init function:
<apex:page action="{!init}" controller="sampleController">
...
</apex:page>
But in my case, the constructors are being called from <apex:component>
and not <apex:page>
. How do I use init function for <apex:component>
? Please guide. Thank You!
Updates:
The constructors of the components are called twice and not the page.
Example of how the classes are called from components:
<apex:component controller="RelatedListDisplayController" allowDML="true">
<apex:actionFunction action="{!DeleteAddress}" name="DeleteAddress" reRender="relcad" oncomplete="window.location.reload(false);">
</apex:actionFunction>
</apex:component>