diff --git a/src/renderer/src/pages/connections.tsx b/src/renderer/src/pages/connections.tsx
index ef18eb6..630310c 100644
--- a/src/renderer/src/pages/connections.tsx
+++ b/src/renderer/src/pages/connections.tsx
@@ -67,15 +67,15 @@ const Connections: React.FC = () => {
})
}, [activeConnections, closedConnections, filter, connectionDirection, connectionOrderBy])
- const closeAllConnections = () => {
+ const closeAllConnections = (): void => {
tab === 'active' ? mihomoCloseAllConnections() : trashAllClosedConnection()
}
- const closeConnection = (id: string) => {
+ const closeConnection = (id: string): void => {
tab === 'active' ? mihomoCloseConnection(id) : trashClosedConnection(id)
}
- const trashAllClosedConnection = () => {
+ const trashAllClosedConnection = (): void => {
const trashIds = closedConnections.map((conn) => conn.id)
setAllConnections((allConns) => allConns.filter((conn) => !trashIds.includes(conn.id)))
setClosedConnections([])
@@ -83,7 +83,7 @@ const Connections: React.FC = () => {
cachedConnections = allConnections
}
- const trashClosedConnection = (id: string) => {
+ const trashClosedConnection = (id: string): void => {
setAllConnections((allConns) => allConns.filter((conn) => conn.id != id))
setClosedConnections((closedConns) => closedConns.filter((conn) => conn.id != id))
@@ -95,7 +95,7 @@ const Connections: React.FC = () => {
setConnectionsInfo(info)
if (!info.connections) return
- const allConns = unionWith(allConnections, activeConnections, (a, b) => a.id === b.id)
+ const allConns = unionWith(activeConnections, allConnections, (a, b) => a.id === b.id)
const activeConns = info.connections.map((conn) => {
const preConn = activeConnections.find((c) => c.id === conn.id)
@@ -105,17 +105,19 @@ const Connections: React.FC = () => {
...conn,
isActive: true,
downloadSpeed: downloadSpeed,
- uploadSpeed: uploadSpeed,
+ uploadSpeed: uploadSpeed
}
})
- const closedConns = differenceWith(allConns, activeConns, (a, b) => a.id === b.id).map((conn) => {
- return {
- ...conn,
- isActive: false,
- downloadSpeed: 0,
- uploadSpeed: 0,
+ const closedConns = differenceWith(allConns, activeConns, (a, b) => a.id === b.id).map(
+ (conn) => {
+ return {
+ ...conn,
+ isActive: false,
+ downloadSpeed: 0,
+ uploadSpeed: 0
+ }
}
- })
+ )
setActiveConnections(activeConns)
setClosedConnections(closedConns)
@@ -165,7 +167,7 @@ const Connections: React.FC = () => {
}
}}
>
- {tab === 'active' ? (