diff --git a/src/components/App.vue b/src/components/App.vue index a1cc48a..19c8629 100644 --- a/src/components/App.vue +++ b/src/components/App.vue @@ -1,10 +1,6 @@ diff --git a/src/components/messages/MessageViewer.vue b/src/components/messages/MessageViewer.vue index f0eccb6..0379c59 100644 --- a/src/components/messages/MessageViewer.vue +++ b/src/components/messages/MessageViewer.vue @@ -126,7 +126,6 @@ export default { data() { return { - isActive: false, messages: [], messagesSubscription: null, @@ -145,20 +144,12 @@ export default { this.messagesSubscription = Database.Message.getNodeMessages(this.nodeId).$.subscribe(this.onMessagesUpdated); } - }, - unmounted() { - this.messagesSubscription?.unsubscribe(); - }, - activated() { - - this.isActive = true; - - // update read state when coming back to message viewer + // update read state this.updateMessagesLastReadAt(); }, - deactivated() { - this.isActive = false; + unmounted() { + this.messagesSubscription?.unsubscribe(); }, methods: { async sendMessage() { @@ -275,11 +266,6 @@ export default { }, updateMessagesLastReadAt() { - // do nothing if route is not active - if(!this.isActive){ - return; - } - // check what type of messages we are viewing if(this.type === "node"){ // update last read at for node messages diff --git a/src/components/pages/MainPage.vue b/src/components/pages/MainPage.vue index 632b967..92f9ce6 100644 --- a/src/components/pages/MainPage.vue +++ b/src/components/pages/MainPage.vue @@ -43,11 +43,6 @@ export default { NodesList, ChannelsList, }, - data() { - return { - tab: 'channels', - }; - }, methods: { onChannelClick(channel) { this.$router.push({ @@ -79,6 +74,19 @@ export default { nodes() { return Object.values(GlobalState.nodesById); }, + tab: { + get(){ + return this.$route.query.tab ?? 'channels'; + }, + set(value){ + this.$router.replace({ + query: { + ...this.$route.query, + tab: value, + }, + }); + }, + }, }, } diff --git a/src/components/pages/NodeRunTraceRoutePage.vue b/src/components/pages/NodeRunTraceRoutePage.vue index bcce921..b8eb768 100644 --- a/src/components/pages/NodeRunTraceRoutePage.vue +++ b/src/components/pages/NodeRunTraceRoutePage.vue @@ -110,10 +110,6 @@ export default { Connection.removeClientNotificationListener(this.onClientNotification); }, - beforeRouteLeave(to, from) { - // ignore previous trace route when coming back - this.isRunningTraceRoute = false; - }, methods: { getNodeLongName: (nodeId) => NodeUtils.getNodeLongName(nodeId), async runTraceRoute(node) { diff --git a/src/js/Connection.js b/src/js/Connection.js index 606b544..daa77cc 100644 --- a/src/js/Connection.js +++ b/src/js/Connection.js @@ -121,12 +121,6 @@ class Connection { return; } - // reset keep alive state. this forces kept alive pages such as MessageViewer to reset - // this allows them to be recreated with a new call to the "mounted" function, which sets up new database subscriptions - // without doing this, when the user opens the MessageViewer when a new database connection was created - // no events will be fired because the subscription is to a previously closed database instance - GlobalState.keepAliveKey++; - // we are starting a new connection, so we want to allow config changes to happen GlobalState.isConfigComplete = false; diff --git a/src/js/GlobalState.js b/src/js/GlobalState.js index f7f2d71..6244235 100644 --- a/src/js/GlobalState.js +++ b/src/js/GlobalState.js @@ -3,8 +3,6 @@ import { reactive } from "vue"; // global state const globalState = reactive({ - keepAliveKey: 0, - isConnected: false, isConfigComplete: false, connection: null,