Skip to content

Commit

Permalink
don't use keep alive
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcottle committed Dec 5, 2024
1 parent 10e0af0 commit 937167a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 39 deletions.
6 changes: 1 addition & 5 deletions src/components/App.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<template>
<div class="w-full">
<RouterView v-slot="{ Component, route }">
<KeepAlive :key="GlobalState.keepAliveKey">
<Component :is="Component" :key="route.fullPath" />
</KeepAlive>
</RouterView>
<RouterView/>
</div>
</template>

Expand Down
20 changes: 3 additions & 17 deletions src/components/messages/MessageViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export default {
data() {
return {
isActive: false,
messages: [],
messagesSubscription: null,
Expand All @@ -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() {
Expand Down Expand Up @@ -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
Expand Down
18 changes: 13 additions & 5 deletions src/components/pages/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ export default {
NodesList,
ChannelsList,
},
data() {
return {
tab: 'channels',
};
},
methods: {
onChannelClick(channel) {
this.$router.push({
Expand Down Expand Up @@ -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,
},
});
},
},
},
}
</script>
4 changes: 0 additions & 4 deletions src/components/pages/NodeRunTraceRoutePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 0 additions & 6 deletions src/js/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions src/js/GlobalState.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { reactive } from "vue";
// global state
const globalState = reactive({

keepAliveKey: 0,

isConnected: false,
isConfigComplete: false,
connection: null,
Expand Down

0 comments on commit 937167a

Please sign in to comment.