FIX: Stability issues with multiple polls

This commit is contained in:
Robin Ward 2016-03-28 12:17:37 -04:00
parent 6b01287e98
commit ef4877e009
1 changed files with 3 additions and 1 deletions

View File

@ -67,6 +67,7 @@ function initializePolls(api) {
if (!$polls.length) { return; }
const post = helper.getModel();
api.preventCloak(post.id);
const votes = post.get('polls_votes') || {};
post.pollsChanged();
@ -82,11 +83,12 @@ function initializePolls(api) {
const $poll = $(pollElem);
const pollName = $poll.data("poll-name");
const pollId = `${pollName}-${post.id}`;
const pollView = createPollView(helper.container, post, polls[pollName], votes[pollName]);
$poll.replaceWith($div);
Em.run.next(() => pollView.renderer.replaceIn(pollView, $div[0]));
postPollViews[pollName] = pollView;
postPollViews[pollId] = pollView;
});
_pollViews = postPollViews;