From aee4c22deef2c90c595e79c3dea44cf6f77133cb Mon Sep 17 00:00:00 2001 From: Peace Date: Sat, 28 Jan 2023 14:28:34 +0100 Subject: [PATCH] perf: only do one filter instead of 3 in editMonitor --- src/pages/EditMonitor.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 8206215e5..b9783c558 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -760,9 +760,13 @@ message HealthCheckResponse { sortedMonitorList() { let result = Object.values(this.$root.monitorList); console.log(this.monitor.childrenIDs); - result = result.filter(monitor => monitor.type === "group"); - result = result.filter(monitor => monitor.id !== this.monitor.id); - result = result.filter(monitor => !this.monitor.childrenIDs?.includes(monitor.id)); + + // Only groups, not itself, not a decendant + result = result.filter( + monitor => monitor.type === "group" && + monitor.id !== this.monitor.id && + !this.monitor.childrenIDs?.includes(monitor.id) + ); result.sort((m1, m2) => {