diff --git a/frontend/src/stores.js b/frontend/src/stores.js index 63e3136..5e83b47 100644 --- a/frontend/src/stores.js +++ b/frontend/src/stores.js @@ -21,11 +21,12 @@ class Store { } subscribe(handler) { - const handlerIndex = this._handlers.push(handler) - 1; + this._handlers.push(handler); storeLog(`(${this.name}) (subscribe/initial)`, this.value); handler(this.value); return () => { - this._handlers.splice(handlerIndex, 1); + const index = this._handlers.indexOf(handler); + this._handlers.splice(index, 1); }; }