fix(core): check if prevClosestHandle exists in onPointerUp

This commit is contained in:
braks
2023-02-06 00:56:23 +01:00
parent 357b3f096f
commit 1d3126e4fe
@@ -154,9 +154,11 @@ export function handlePointerDown({
} }
function onPointerUp(event: MouseEvent | TouchEvent) { function onPointerUp(event: MouseEvent | TouchEvent) {
if (prevClosestHandle) {
if (connection && isValid) { if (connection && isValid) {
onConnect?.(connection); onConnect?.(connection);
} }
}
// it's important to get a fresh reference from the store here // it's important to get a fresh reference from the store here
// in order to get the latest state of onConnectEnd // in order to get the latest state of onConnectEnd