fix(dashboard): controlled Switch for disease status
The disease status Switch used defaultChecked, but row.status loads async and changes via changeData, triggering MUI's uncontrolled→ controlled warning. Drive it with checked from row.status instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -56,7 +56,7 @@ function Disease({ data, setData, updateData, loading }) {
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
<Switch
|
||||
defaultChecked={row.status === "true"}
|
||||
checked={row.status === "true" || row.status === true}
|
||||
onChange={(e) => {
|
||||
changeData(idx, JSON.stringify(e.target.checked));
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user