By default react query does actually have this behaviour where re-focusing the tab will refresh data, so that might be throwing you off, but equally there might be some other setting you've tweaked which is preventing an immediate refresh
Shouldn't the queryclient not be in the dependency array of the useEffect? Basically the useEffect only runs when selectedApp changes, but doesn't necessarily have the right queryClient there... Just guessing. But yeah invalidateQueries is async operation and if you depend on some of the returns it needs to be awaited...