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]);