Fix stale closure bug in QueryProvider (token ref) and add warning toast so users know why they were redirected to login.