Tags: saonam/react-query
Tags
feat: add initialStale option to queries
By default `initialData` is not considered stale, but sometimes you may want it to be, for instance, if your initial data is only a partial subset of an object and you know you will need to refetch the full version immediately after mounting. For this, you can use the `initialStale: true` options.
By setting `initialStale` to `true`, the `initialData` will be considered `stale` and will cause a refetch when the query mounts for the first time.
```js
function Todos() {
const queryInfo = useQuery('todos', () => fetch('/todos'), {
initialData: todoListPreview,
initialStale: true,
})
}
```
Merge branch 'master' of https://github.com/tannerlinsley/react-query
fix: query.state.isFetching defaults to the loading status, despite l… …ack of data Fixes TanStack#624
Merge branch 'master' of https://github.com/tannerlinsley/react-query
PreviousNext