diff options
Diffstat (limited to 'app/javascript/mastodon/containers/poll_container.js')
-rw-r--r-- | app/javascript/mastodon/containers/poll_container.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/javascript/mastodon/containers/poll_container.js b/app/javascript/mastodon/containers/poll_container.js index cd7216de7..1c2e8d2a7 100644 --- a/app/javascript/mastodon/containers/poll_container.js +++ b/app/javascript/mastodon/containers/poll_container.js @@ -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); |