Fix turbolinks issue by cleaning up droplab on page:change

This commit is contained in:
Clement Ho 2016-12-08 15:42:58 -06:00
parent 367a15882a
commit 3cf0ee6c1f
1 changed files with 19 additions and 0 deletions

View File

@ -81,6 +81,25 @@
this.bindEvents();
loadSearchParamsFromURL();
this.setDropdown();
document.addEventListener('page:change', this.cleanup);
}
cleanup() {
console.log('cleanup')
if (this.droplab) {
this.droplab.destroy();
this.droplab = null;
}
dropdownHint = null;
dropdownAuthor = null;
dropdownAssignee = null;
dropdownMilestone = null;
dropdownLabel = null;
document.removeEventListener('page:change', this.cleanup);
}
static addWordToInput(word, addSpace) {