Query trigger after invalidateCache() sometimes returns cached query

How are you managing the execution order of the event handlers? The order in the UI is irrelevant - they are executed asynchronously. To make sure they all run in the order you want, you need to handle it differently (e.g. here).