Interesting fact about using TanStack Query within NextJS's AppRouter is that you need to prefetch all queries that you are using in client components.
If the query is dependant on some variable, which is not connected with query directly (e.g. its key), use imperative fetch (docs) via queryClient hook.
===
This was helpful resource too:
https://www.robinwieruch.de/next-server-actions-fetch-data/