Every time you use setCurrentBotId it causes a rerender for App component and it recreates a new instance of query client. To fix this, define the query client like below
setCurrentBotId
App
const [queryClient] = useState(new QueryClient())