ui events: prevent sending 2nd event unnecessarily (#2921)

Noticed that we were sending two events (one for pointerDown, and one
for pointerUp). The click event handler adds this same check to prevent
this, so this adds it in the pointerUp event as well.

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Some cleanup on duplicate UI events being sent.
This commit is contained in:
Mime Čuvalo 2024-02-26 10:08:27 +00:00 committed by GitHub
parent f3eae3c398
commit 8499af6945
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,6 +78,8 @@ function _TldrawUiButtonPicker<T extends string>(props: TLUiButtonPickerProps<T>
const handleButtonPointerUp = (e: React.PointerEvent<HTMLButtonElement>) => { const handleButtonPointerUp = (e: React.PointerEvent<HTMLButtonElement>) => {
const { id } = e.currentTarget.dataset const { id } = e.currentTarget.dataset
if (value.type === 'shared' && value.value === id) return
onValueChange(style, id as T, false) onValueChange(style, id as T, false)
} }