refresh() instance method on PromiseState
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 137
- PR merge metrics
- No merged PRs in 30d
Description
I'm new to the library but i've been using the manual refresh pattern from the readme a lot because each of my screens have a refresh button.
```
connect(props => {
const url = `/users/${props.userId}`
return {
userFetch: url,
refreshUser: () => ({
userFetch: {
url,
force: true,
refreshing: true
}
})
}
})(Profile)
```
Reading through the documentation for [PromiseState](https://github.com/heroku/react-refetch/blob/master/docs/api.md#promisestate) i noticed that there is a refresh() static method but not an instance method. I think adding it as an instance method would be hugely helpful to a lot of people. It would reduce the above to:
```
connect(props => ({
userFetch: `/users/${props.userId}`,
})(Profile)
```
and then call the refresh using `props.userFetch.refresh()`
Am i missing something? It doesn't look like anyone has mentioned it before, do they just write the extra code?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.