fix(admin/models): make account->model and model->effort cascade fire on first pick
The account and model <select>s had no value="" placeholder option, so a controlled value of "" made the browser display the first real entry as if it were already chosen. Clicking that entry was not a change, so onChange never fired and the cascade (account->catalog, model->efforts) only ran after a *second*, different selection. Prepend a real value="" placeholder option to both dropdowns so the displayed value matches the controlled state and the first real selection now triggers onChange as expected.
This commit is contained in:
@@ -320,7 +320,7 @@ export default function AdminModelsPage() {
|
|||||||
options={
|
options={
|
||||||
accountOptions.length === 0
|
accountOptions.length === 0
|
||||||
? [{ value: "", label: "اکانتی ثبت نشده — ابتدا اکانت agy بسازید" }]
|
? [{ value: "", label: "اکانتی ثبت نشده — ابتدا اکانت agy بسازید" }]
|
||||||
: accountOptions
|
: [{ value: "", label: "اکانت agy را انتخاب کنید" }, ...accountOptions]
|
||||||
}
|
}
|
||||||
hint="کاتالوگ مدلها از همین اکانت خوانده میشود."
|
hint="کاتالوگ مدلها از همین اکانت خوانده میشود."
|
||||||
/>
|
/>
|
||||||
@@ -339,7 +339,7 @@ export default function AdminModelsPage() {
|
|||||||
? [{ value: "", label: "در حال بارگذاری کاتالوگ…" }]
|
? [{ value: "", label: "در حال بارگذاری کاتالوگ…" }]
|
||||||
: modelOptions.length === 0
|
: modelOptions.length === 0
|
||||||
? [{ value: "", label: "کاتالوگی برای این اکانت نیست" }]
|
? [{ value: "", label: "کاتالوگی برای این اکانت نیست" }]
|
||||||
: modelOptions
|
: [{ value: "", label: "یک مدل انتخاب کنید" }, ...modelOptions]
|
||||||
}
|
}
|
||||||
disabled={!accountId || catalogLoading || modelOptions.length === 0}
|
disabled={!accountId || catalogLoading || modelOptions.length === 0}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user