T
TanStack3y ago
like-gold

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.jsx
sgarcia-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
sensitive-blue3y ago
flat-fuchsia
flat-fuchsia3y ago

Did you find this page helpful?