From 2cd4d87d0aaba702a0752f4b5bcbe91d84cb4202 Mon Sep 17 00:00:00 2001 From: Rinsvent Date: Wed, 25 Jan 2023 23:34:36 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D1=83=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=B8=D0=B7=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D1=81=D1=81?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/elements/commands/elements/argument/index.tsx | 2 +- components/elements/commands/elements/options/index.tsx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/components/elements/commands/elements/argument/index.tsx b/components/elements/commands/elements/argument/index.tsx index a7024f6..d5ad791 100644 --- a/components/elements/commands/elements/argument/index.tsx +++ b/components/elements/commands/elements/argument/index.tsx @@ -13,7 +13,7 @@ export interface ArgumentInterface { export default function Argument(argument: ArgumentInterface) { let {argumentList, setArgumentList} = useContext(Context) - let [value, setValue] = useState('') + let [value, setValue] = useState(argumentList[argument.name] || '') useEffect(() => { let temp = { diff --git a/components/elements/commands/elements/options/index.tsx b/components/elements/commands/elements/options/index.tsx index 4e0a236..6ba06ac 100644 --- a/components/elements/commands/elements/options/index.tsx +++ b/components/elements/commands/elements/options/index.tsx @@ -11,8 +11,7 @@ interface OptionsInterface { export default function Options({optionList}: OptionsInterface) { let {optionList: ol, setOptionList} = useContext(Context) let [selectedOptions, setSelectedOptions] = useState([]); - let [values, setValues] = useState([]); - let [selectedValues, setSelectedValues] = useState([]); + let [selectedValues, setSelectedValues] = useState(Object.keys(ol) || []); useEffect(() => { let result: OptionInterface[] = []; @@ -25,7 +24,7 @@ export default function Options({optionList}: OptionsInterface) { let temp: any = {} optionList.forEach((value, index, array) => { let check = selectedValues.find(item => item === value.name) - check && (temp[value.name] = value.acceptValue ? '' : null) + check && (temp[value.name] = value.acceptValue ? '' : true) }) setOptionList(temp) }, [selectedValues]);