Commit e8dcd004 authored by Chunchi Che's avatar Chunchi Che

fix

parent e62cf7c5
Pipeline #21025 passed with stages
in 18 minutes and 6 seconds
......@@ -16,13 +16,14 @@ const CheckCounterModal = () => {
const counterName = fetchStrings("!counter", `0x${state.counterType!}`);
const min = state.min || 0;
const options = state.options;
const [selected, setSelected] = useState(options.map((_) => 0));
const finishable = selected.reduce((sum, current) => sum + current, 0) == min;
const [selected, setSelected] = useState(new Array(options.length));
const sum = selected.reduce((sum, current) => sum + current, 0);
const finishable = sum == min;
const draggleRef = useRef<HTMLDivElement>(null);
const onFinish = () => {
sendSelectCounterResponse(selected);
dispatch(clearCheckCounter);
dispatch(clearCheckCounter());
};
return (
......@@ -59,10 +60,10 @@ const CheckCounterModal = () => {
max={option.max}
defaultValue={0}
onChange={(value) => {
setSelected((prev) => ({
...prev,
[idx]: value || 0,
}));
let newSelected = [...selected];
newSelected[idx] = value || 0;
setSelected(newSelected);
}}
/>
</Card>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment