Day 1 of Ask TanStack Query: Why AI Gives Outdated TanStack Query v5 Answers
I asked an AI five questions about TanStack Query. The code looked right, but two of the answers used APIs that v5 removed or renamed. That gap is the reason I am building Ask TanStack Query.
The short version
Ask TanStack Query is an unofficial AI docs assistant I am building in public. It answers questions about TanStack Query from the current official documentation and shows which page each answer came from.
On Day 1 I did not build the assistant. I set up the project, made my first model call, and wrote down what goes wrong today. I asked a general AI assistant five questions about TanStack Query v5. Two of the answers were out of date, and nothing in them said so.
What I asked, and what went wrong
Both answers below were polished and confident. Both would have sent a developer down the wrong path.
1. Running code after a query succeeds
I asked how to run code after a query succeeds in TanStack Query v5. The answer reached for an onSuccess callback on the query:
onSuccess: (data) => {
// Code to run after the query succeeds
doSomethingWithTodos(data);
}That is the v4 way. TanStack Query v5 removed the onSuccess, onError, and onSettled callbacks from useQuery. Someone pasting this into a v5 project gets code that quietly does nothing, with no error to point at the cause.
2. Sharing options between useQuery and prefetchQuery
I asked how to share query options between useQuery and prefetchQuery. The answer built a plain object and included cacheTime:
const sharedQueryOptions = {
staleTime: 5 * 60 * 1000, // 5 minutes
cacheTime: 60 * 60 * 1000, // 1 hour
refetchOnWindowFocus: false
}In v5, cacheTime was renamed to gcTime. The old name is not recognized, so the option does nothing. The answer also missed that v5 has a dedicated queryOptions helper for exactly this job.
Why AI assistants give outdated TanStack Query answers
A language model answers from what it learned during training. If a library changed after that, or if years of older tutorials outweigh the newer docs, the model repeats the older pattern. It has no way to check the version you are using, and it sounds equally sure either way.
The danger is how the failure looks. A removed callback does not crash. A renamed option does not warn. The answer reads fine, and the mistake surfaces later as behavior that does not match what you expected.
Put simply, the AI is remembering an old manual. The fix is to stop asking it to remember and make it look things up.
The plan: look up the current docs, then answer
Ask TanStack Query is built around retrieval-augmented generation (RAG). In plain terms, the program searches the official docs first, then asks the model to answer using only what it found. It follows five steps:
- Ingest: read the official React docs, split each page into chunks, and store them with embeddings in Postgres
- Retrieve: find passages by keyword and by meaning
- Rerank: narrow the shortlist to the five best passages
- Answer: stream a response that cites the docs pages it used, and say so when the docs do not contain the answer
- Grade: score every change against a quiz of real GitHub questions and keep a scoreboard
The last step matters most to me. A demo that works once proves little. A scoreboard shows whether each change helps. You can read the full plan on the Ask TanStack Query case study.
What I set up on Day 1
Day 1 was three small commits. None of them is impressive on its own, and that is the point of building in public: the groundwork is part of the story.
- A backend starter workspace. A Python 3.12 project managed with uv, with the OpenAI SDK and python-dotenv as the first dependencies. The
.gitignorekeeps.envand local secrets out of the repository from the first commit. - A hello script. My first model call. It takes a question from the command line, sends it to the model named in an environment variable, and prints the answer along with the input and output tokens used. Counting tokens from the start means I will know what every later change costs.
- A journal of the wrong answers. I saved the two outdated answers above, word for word, in a
JOURNAL.mdfile as the “before” examples.
Why I saved the wrong answers first
Before I build the fix, I want a record of the problem. Those two answers are now my baseline. When the assistant can answer the same questions from the current docs, I can put the old answer and the new one side by side and show the difference instead of describing it.
It also keeps me honest. If the finished assistant still produces cacheTime or an onSuccess callback on a query, the journal will show that I did not fix the problem.
Frequently asked questions
Does TanStack Query v5 still support onSuccess?
Not on useQuery. v5 removed the onSuccess, onError, and onSettled callbacks from queries. Mutations still have their own callbacks.
What replaced cacheTime in TanStack Query v5?
cacheTime was renamed to gcTime. It controls how long unused query data stays in the cache before it is garbage collected.
Why do AI assistants give outdated library answers?
They answer from training data, which can lag behind a library's current release and can be dominated by older tutorials. Retrieving the current documentation at question time is one way to reduce that.
Is Ask TanStack Query an official TanStack project?
No. It is an unofficial portfolio project. It does not edit the docs, post in GitHub Discussions, or speak for the TanStack team.
Next up
Day 2 is about getting the official docs onto my machine, so the assistant has something to look up. I will write about what I learn as I go, including the mistakes.
If you want to follow along, the repository is public and every day lands as a commit.
