Calculate query up front, not just on "ready" event.