FIX: Remove the old poll view before replacing it

This commit is contained in:
Robin Ward 2016-12-02 16:41:51 -05:00
parent dafd1453d6
commit ffae39912f

View File

@ -88,8 +88,16 @@ function initializePolls(api) {
votes[pollName]
);
// Destroy a poll view if we're replacing it
if (_pollViews && _pollViews[pollId]) {
_pollViews[pollId].destroy();
}
$poll.replaceWith($div);
Em.run.schedule('afterRender', () => pollComponent.renderer.appendTo(pollComponent, $div[0]));
Ember.run.scheduleOnce('afterRender', () => {
pollComponent.renderer.appendTo(pollComponent, $div[0]);
});
postPollViews[pollId] = pollComponent;
});