more cleanup

This commit is contained in:
liamcottle 2024-08-06 01:31:34 +12:00
commit bf955f6854
3 changed files with 15 additions and 13 deletions

View file

@ -267,6 +267,8 @@ export default {
data() {
return {
reloadInterval: null,
isShowingMyIdentitySection: true,
isShowingAnnounceSection: true,
isShowingCallsSection: true,
@ -280,8 +282,12 @@ export default {
};
},
beforeUnmount() {
clearInterval(this.reloadInterval);
// stop listening for websocket messages
WebSocketConnection.off("message", this.onWebsocketMessage);
},
mounted() {
@ -293,7 +299,7 @@ export default {
// fixme: clear interval on unmount
// update info every few seconds
setInterval(() => {
this.reloadInterval = setInterval(() => {
this.updateCallsList();
}, 3000);

View file

@ -127,8 +127,6 @@ export default {
formatBytes: function(bytes) {
return Utils.formatBytes(bytes);
},
},
computed: {
isElectron() {
return ElectronUtils.isElectron();
},

View file

@ -186,18 +186,21 @@ export default {
return {
interfaces: {},
interfaceStats: {},
reloadInterval: null,
};
},
beforeUnmount() {
clearInterval(this.reloadInterval);
},
mounted() {
this.loadInterfaces();
this.updateInterfaceStats();
// fixme: clear interval on unmount
// update info every few seconds
setInterval(() => {
this.reloadInterval = setInterval(() => {
this.updateInterfaceStats();
}, 3000);
}, 1000);
},
methods: {
@ -209,13 +212,8 @@ export default {
},
async loadInterfaces() {
try {
// fetch interfaces
const response = await window.axios.get(`/api/v1/reticulum/interfaces`);
// update ui
this.interfaces = response.data.interfaces;
} catch(e) {
// do nothing if failed to load interfaces
}
@ -352,11 +350,11 @@ export default {
formatBytes: function(bytes) {
return Utils.formatBytes(bytes);
},
},
computed: {
isElectron() {
return ElectronUtils.isElectron();
},
},
computed: {
interfacesWithStats() {
const results = [];
for(const [interfaceName, iface] of Object.entries(this.interfaces)){