Skip to content

Commit 676456b

Browse files
committed
fix(multistatebox): prevent clicking twice
Add preventDefault to avoid having two clicks and thus two state updates. The two state updates lead to a race condition that is the another root cause for #7.
1 parent 6032d9c commit 676456b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/webview/src/components/multiStateBox.js

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export default function MultiStateBox(props) {
4444
const curColor = curValuePair.color || props.color; // we do allow to overwrite
4545

4646
const handleClick = (event) => {
47+
//console.warn(`MultiStateBox handleClick(...)`, event);
48+
event.preventDefault();
4749
// toggle the value through the array:
4850
const curIdx = props.values.findIndex((valuePair) => valuePair.value === curValue);
4951
let nextIdx = 0;

0 commit comments

Comments
 (0)