From 41f950985bf69d36a3ea37aaf32686196912c95e Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Mon, 15 Jun 2026 21:53:39 +0330 Subject: [PATCH] fix(dashboard): guard select .find().id crashes in account form Clearing the blood type / education / insurance selects made .find(...).id (and val.id) read .id on undefined, crashing the account form. Use optional chaining with empty-string/empty-array fallbacks. Co-Authored-By: Claude Opus 4.8 --- .../userAccount/detailUser/information/form/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/dashboard/userAccount/detailUser/information/form/index.js b/components/dashboard/userAccount/detailUser/information/form/index.js index b6f0048..7066c94 100644 --- a/components/dashboard/userAccount/detailUser/information/form/index.js +++ b/components/dashboard/userAccount/detailUser/information/form/index.js @@ -110,7 +110,7 @@ function Form({ insurance, errors, changeData, information }) { { - changeData([Number(val.id)], name); + changeData(val?.id ? [Number(val.id)] : [], name); }} value={insurance?.find( (g) => @@ -144,7 +144,7 @@ function Form({ insurance, errors, changeData, information }) { - changeData(blood_group.find((g) => g.label === value).id, name) + changeData(blood_group.find((g) => g.label === value)?.id ?? "", name) } value={findVal(blood_group, "blood_type")} label="گروه خونی" @@ -178,7 +178,7 @@ function Form({ insurance, errors, changeData, information }) { - changeData(education.find((g) => g.label === value).id, name) + changeData(education.find((g) => g.label === value)?.id ?? "", name) } value={findVal(education, "education")} label="تحصیلات"