didierfranc / didierfranc/react-waterfall
Only re-render if action creator returns an object
- Dominant language
- JavaScript
- Stars
- 1.3k
- Forks
- 73
- PR merge metrics
- No merged PRs in 30d
Description
First of all, thanks for the great library!
Here's a proposal for a feature: To allow an action creator to return `false` or `{}` in order not to re-render the connected components.
We're having an issue in our app where we need to have a timeout running every 100ms to fetch updates from a backend. Most of the time, this fetch returns an identical object to that in state and we don't want to re-render all our connected components. So our action creator looks like this (using immutable):
```js
{
actionsCreators: {
syncData: async ({ data }) => {
const newData = await api.get('/data');
return data.equals(newData) ? {} : { data: newData };
}
}
}
```
So we return an empty object if the data did not change. However, this still causes `react-waterfall` to re-render every connected component. It seems like it would be easy to implement something where we can return `false` or an empty object in order not to make `react-waterfall` re-render.
Is this a PR that you would be interested in?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.