diff --git a/frontend/src/stores.js b/frontend/src/stores.js index 7bcfd8e..1d454fc 100644 --- a/frontend/src/stores.js +++ b/frontend/src/stores.js @@ -15,7 +15,6 @@ class Store { // like subscribe, but without initially calling the handler watch(handler) { const handlerIndex = this._handlers.push(handler) - 1; - storeLog(`(${this.name}) (watch/handler) New handler`, this.value); return () => { this._handlers.splice(handlerIndex, 1); }; @@ -23,7 +22,7 @@ class Store { subscribe(handler) { const handlerIndex = this._handlers.push(handler) - 1; - storeLog(`(${this.name}) (subscribe/initial) Calling handler`, this.value); + storeLog(`(${this.name}) (subscribe/initial)`, this.value); handler(this.value); return () => { this._handlers.splice(handlerIndex, 1); @@ -60,7 +59,7 @@ class ChannelsStore extends Store { gateway.subscribe(GatewayEventType.Ready, ({ channels }) => { this.value = channels; if (getItem("ui:stateful:presistSelectedChannel")) { - selectedChannel.set({ id: getItem("state:openChannelId"), name: "none", creator_id: -1 }); + selectedChannel.value.id = getItem("state:openChannelId"); } if (channels.length >= 1) { if (!selectedChannel.value || selectedChannel.value.id === -1) { @@ -119,15 +118,9 @@ class ChannelsStore extends Store { class GatewayStatusStore extends Store { constructor() { - super({ open: gateway.open, ready: gateway.authenticated }, "GatewayStatusStore"); - - gateway.subscribe(GatewayEventType.Open, () => { - this.value.open = true; - this.updated(); - }); + super({ ready: gateway.authenticated }, "GatewayStatusStore"); gateway.subscribe(GatewayEventType.Close, () => { - this.value.open = false; this.value.ready = false; this.updated(); });