Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Poll fetchPoll action not being debounced. (#13485)
* Fix Poll fetchPoll action not being debounced. * Fix unused import in the Poll component
- Loading branch information
Showing
2 changed files
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import { connect } from 'react-redux'; | ||
import { debounce } from 'lodash'; | ||
|
||
import Poll from 'mastodon/components/poll'; | ||
import { fetchPoll } from 'mastodon/actions/polls'; | ||
|
||
const mapDispatchToProps = (dispatch, { pollId }) => ({ | ||
refresh: debounce( | ||
() => { | ||
dispatch(fetchPoll(pollId)); | ||
}, | ||
1000, | ||
{ leading: true }, | ||
), | ||
}); | ||
|
||
const mapStateToProps = (state, { pollId }) => ({ | ||
poll: state.getIn(['polls', pollId]), | ||
}); | ||
|
||
export default connect(mapStateToProps)(Poll); | ||
export default connect(mapStateToProps, mapDispatchToProps)(Poll); |