I have a VF page with a handful of apex:repeat tags - each of which references a getter, which runs a soql query to retrieve data. I also have an actionpoller in the page to refresh it every 15 seconds.
I started getting the 101 SOQL Query error - even though I was well short of 101 queries. The error only occurs on the actionpoller refresh - so if I load the page manually, it loads without incident. I did some debugging, and I see that when the page re-loads as part of the actionpoller, all of the getters are called twice.
Debugging further, I see that if i put the getters in an outputText tag, the getters are only called once. Odd.
Is this expected behavior as per the post below? Setter executes twice when attributes are defined on components - and specifically per this documentation:
It’s a best practice for getter methods to be idempotent, that is, to not have side effects. For example, don’t increment a variable, write a log message, or add a new record to the database. Visualforce doesn’t define the order in which getter methods are called, or how many times they might be called in the course of processing a request. Design your getter methods to produce the same outcome, whether they are called once or multiple times for a single page request.
Or is there something else happening here which is causing the getters to be called twice? I've stripped the code to a pretty minimal version and I'm clearly seeing the behavior in the debug logs. (I just did a bit more debugging, and it seems that the controller behavior is dramatically different between calling via outputText and repeat...)
thanks so much for your help. chris