forked from mirror/Part-DB.Part-DB-server
Properly destroy tomSelect on disconnect()
This commit is contained in:
parent
f22d65cd24
commit
400cc44838
7 changed files with 44 additions and 0 deletions
|
@ -31,6 +31,8 @@ export default class extends Controller
|
|||
|
||||
static targets = ["name", "symbol", "unit"]
|
||||
|
||||
_tomSelect;
|
||||
|
||||
onItemAdd(value, item) {
|
||||
//Retrieve the unit and symbol from the item
|
||||
const symbol = item.dataset.symbol;
|
||||
|
@ -116,4 +118,10 @@ export default class extends Controller
|
|||
|
||||
this._tomSelect = new TomSelect(this.nameTarget, settings);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
super.disconnect();
|
||||
//Destroy the TomSelect instance
|
||||
this._tomSelect.destroy();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue