fix: prevent click navigation after long press on session list (#52)

This commit is contained in:
Jovines
2026-01-10 19:58:20 +08:00
committed by GitHub
parent 325e4b61ea
commit 2fb61940e4
2 changed files with 7 additions and 4 deletions
+5 -2
View File
@@ -189,7 +189,11 @@ function SessionItem(props: {
haptic.impact('medium')
setMenuOpen(true)
},
onClick: () => onSelect(s.id),
onClick: () => {
if (!menuOpen) {
onSelect(s.id)
}
},
threshold: 500
})
@@ -197,7 +201,6 @@ function SessionItem(props: {
const statusDotClass = s.active
? (s.thinking ? 'bg-[#007AFF]' : 'bg-[var(--app-badge-success-text)]')
: 'bg-[var(--app-hint)]'
return (
<>
<button
+2 -2
View File
@@ -63,7 +63,7 @@ export function useLongPress(options: UseLongPressOptions): UseLongPressHandlers
}, [startTimer])
const onMouseUp = useCallback<React.MouseEventHandler>(() => {
handleEnd(true)
handleEnd(!isLongPressRef.current)
}, [handleEnd])
const onMouseLeave = useCallback<React.MouseEventHandler>(() => {
@@ -78,7 +78,7 @@ export function useLongPress(options: UseLongPressOptions): UseLongPressHandlers
if (isLongPressRef.current) {
e.preventDefault()
}
handleEnd(true)
handleEnd(!isLongPressRef.current)
}, [handleEnd])
const onTouchMove = useCallback<React.TouchEventHandler>(() => {