Closed as not planned
Closed as not planned
Description
Describe the bug
If a query has ever errored, getOptimisticResult()
will always return an error status (rather than a pending one)
Your minimal, reproducible example
https://codesandbox.io/p/devbox/winter-darkness-k48yny
Steps to reproduce
- Fail a query
- Try to use
useQuery().promise
somewhere else - Component always fails, rather than optimistically fetching when it renders
Expected behavior
If the getOptimisticResult()
should reflect the actual optimistic result, it should be pending
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
CodeSandbox
Tanstack Query adapter
None
TanStack Query version
latest
TypeScript version
latest
Additional context
Discovered while trying to fix #8499 and tried to fix in the same PR, but will try to have a stab on doing it separately
Metadata
Metadata
Assignees
Labels
No labels