refactor(MikrotikTools): streamline interface filtering logic by moving it to a new useMemo hook for improved performance and readability
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m3s

This commit is contained in:
2026-02-17 22:32:28 +07:00
parent d9667a06e6
commit ab4ba37d53
+15 -12
View File
@@ -121,18 +121,6 @@ function MikrotikTools() {
[networkConfig]
);
const interfacesForServer = useMemo(() => {
if (!serverId || !interfaces.length) return [];
const ids = new Set(
[serverId, currentServer?.id, currentServer?.ip, currentServer?.dns]
.filter(Boolean)
.map(String)
);
return interfaces.filter(
(i) => i && i.name && (ids.has(String(i.serverId)) || ids.has(String(i.serverId2)))
);
}, [interfaces, serverId, currentServer]);
const formatMbps = (bps) => {
if (bps == null || Number.isNaN(bps)) return '—';
const mbps = bps / 1_000_000;
@@ -300,6 +288,21 @@ function MikrotikTools() {
[jumphostServers, serverId]
);
const interfacesForServer = useMemo(() => {
if (!serverId || !interfaces.length) return [];
const ids = new Set(
[serverId, currentServer?.id, currentServer?.ip, currentServer?.dns]
.filter(Boolean)
.map(String)
);
return interfaces.filter(
(i) =>
i &&
i.name &&
(ids.has(String(i.serverId)) || ids.has(String(i.serverId2)))
);
}, [interfaces, serverId, currentServer]);
const gatewaysForServer = useMemo(() => {
if (!serverId || !gateways.length) return [];
const ids = currentServer