From 6720e02766441036d872203216a1d9a45025f5a9 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 28 Jun 2025 10:35:02 +0700
Subject: <hafid> fix cities address

---
 src/lib/address/components/CreateAddress.jsx | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

(limited to 'src/lib/address/components/CreateAddress.jsx')

diff --git a/src/lib/address/components/CreateAddress.jsx b/src/lib/address/components/CreateAddress.jsx
index 35c966c7..963a19aa 100644
--- a/src/lib/address/components/CreateAddress.jsx
+++ b/src/lib/address/components/CreateAddress.jsx
@@ -94,14 +94,13 @@ const CreateAddress = () => {
   useEffect(() => {
     if (detailAddress && Object.keys(detailAddress).length > 0) {
       const selectedCities = cities.find(
-        (city) =>
-          detailAddress?.district
-            .toLowerCase()
-            .includes(city.label.toLowerCase()) ||
-          city.label
-            .toLowerCase()
-            .includes(detailAddress?.district.toLowerCase())
-      );
+          (city) => 
+            city.label.toLowerCase() === detailAddress?.district.toLowerCase()
+        ) || cities.find(
+          (city) =>
+            detailAddress?.district.toLowerCase().includes(city.label.toLowerCase()) ||
+            city.label.toLowerCase().includes(detailAddress?.district.toLowerCase())
+        );
       setValue('city', selectedCities?.value);
     }
   }, [cities, detailAddress, setValue]);
-- 
cgit v1.2.3

