Skip to content

Commit

Permalink
fix(useDoubleClick): make it OR decision
Browse files Browse the repository at this point in the history
otherwise the single click already does a potential state change in the actual application (e.g. url change) and the double click is never registered
  • Loading branch information
rwieruch committed Feb 14, 2025
1 parent 77d33b1 commit 11e1ccb
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/table/Row/useDoubleClick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ const useDoubleClickBase = ({

const handleDoubleClick = (event: any) => {
if (onDoubleClick) {
if (clickCount.current === 0) {
onSingleClick(event);
}

clickCount.current += 1;

setTimeout(() => {
if (clickCount.current === 2) onDoubleClick(event);
if (clickCount.current === 1) onSingleClick(event);
else if (clickCount.current === 2) onDoubleClick(event);

clickCount.current = 0;
}, 300);
}, 100);
}
};

Expand Down

0 comments on commit 11e1ccb

Please sign in to comment.