From aa35e9211bbb135af0178b1046f3a55c48582552 Mon Sep 17 00:00:00 2001 From: Jesulayomy Date: Sat, 2 Aug 2025 04:13:29 -0400 Subject: [PATCH] [Infra]: Removed duplicate call to .find method on the errors object --- client/src/Pages/Infrastructure/Create/index.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/src/Pages/Infrastructure/Create/index.jsx b/client/src/Pages/Infrastructure/Create/index.jsx index 50609b588..ae95cce33 100644 --- a/client/src/Pages/Infrastructure/Create/index.jsx +++ b/client/src/Pages/Infrastructure/Create/index.jsx @@ -102,9 +102,8 @@ const CreateInfrastructureMonitor = () => { }; const getAlertError = (errors) => { - return Object.keys(errors).find((key) => key.startsWith(METRIC_PREFIX)) - ? errors[Object.keys(errors).find((key) => key.startsWith(METRIC_PREFIX))] - : null; + const errorKey = Object.keys(errors).find((key) => key.startsWith(METRIC_PREFIX)); + return errorKey ? errors[errorKey] : null; }; // Populate form fields if editing