From 21676857b42090622855498397be28762e93129e Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Mon, 15 Jun 2026 22:13:37 +0330 Subject: [PATCH] fix(dashboard): account selects store option id, not label match MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DefaultSelect's onChange passes the whole option object {label,id}, but the gender/blood_type/marital/education/job handlers compared it as a string (education/blood via find(g=>g.label===value), others via ===), so the value never stored — education in particular always saved empty. Read option?.id uniformly across all five selects. Co-Authored-By: Claude Opus 4.8 --- .../detailUser/information/form/index.js | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/components/dashboard/userAccount/detailUser/information/form/index.js b/components/dashboard/userAccount/detailUser/information/form/index.js index 7066c94..7e822b9 100644 --- a/components/dashboard/userAccount/detailUser/information/form/index.js +++ b/components/dashboard/userAccount/detailUser/information/form/index.js @@ -74,9 +74,7 @@ function Form({ insurance, errors, changeData, information }) { - changeData(data === "زن" ? "female" : "male", name) - } + updateData={(name, option) => changeData(option?.id ?? "", name)} value={findVal(gender, "gender")} label="جنسیت" name="gender" @@ -143,9 +141,7 @@ function Form({ insurance, errors, changeData, information }) { - changeData(blood_group.find((g) => g.label === value)?.id ?? "", name) - } + updateData={(name, option) => changeData(option?.id ?? "", name)} value={findVal(blood_group, "blood_type")} label="گروه خونی" name="blood_type" @@ -155,9 +151,7 @@ function Form({ insurance, errors, changeData, information }) { - changeData(value === "متاهل" ? "married" : "single", name) - } + updateData={(name, option) => changeData(option?.id ?? "", name)} value={findVal(marital_status, "marital_status")} label="وضعیت تاهل" name="marital_status" @@ -177,9 +171,7 @@ function Form({ insurance, errors, changeData, information }) { - changeData(education.find((g) => g.label === value)?.id ?? "", name) - } + updateData={(name, option) => changeData(option?.id ?? "", name)} value={findVal(education, "education")} label="تحصیلات" name="education" @@ -189,9 +181,7 @@ function Form({ insurance, errors, changeData, information }) { - changeData(value === "آزاد" ? "azad" : "dolati", name) - } + updateData={(name, option) => changeData(option?.id ?? "", name)} value={findVal(job, "job")} label="شغل" name="job"