Why is `isLoading` initialized to `false` instead of `true` for queries with `placeholderData`?
The docs for
status (which isLoading is derived from) say loading is enabled when "there's no cached data and no query attempt was finished yet." However, the docs for placeholderData say "placeholderData is not persisted to the cache"
So what's going on?
My use case is I have a query which I would like to initialize with placeholderData during initial load, but still have a correct initial isLoading flag set to false
Sandbox link:
https://codesandbox.io/s/magical-turing-kc2ntd?file=/src/index.jsxsgarcia-dev
CodeSandbox
magical-turing-kc2ntd - CodeSandbox
magical-turing-kc2ntd by sgarcia-dev using @tanstack/react-query, @tanstack/react-query-devtools, axios, react, react-dom
2 Replies
sensitive-blue•3y ago
flat-fuchsia•3y ago
A similar question was answered recently: https://discord.com/channels/719702312431386674/1074431551347101717