Fix bug in channel rendering

Fix drag and drop stale state bug revealed by the channel panel

co-authored-by: Max <max@zed.dev>
This commit is contained in:
Mikayla 2023-09-20 16:35:37 -07:00
parent 4ff44dfa3b
commit f2f507e619
No known key found for this signature in database
3 changed files with 50 additions and 64 deletions

View file

@ -364,9 +364,15 @@ impl<V: 'static> Draggable<V> for MouseEventHandler<V> {
DragAndDrop::<D>::drag_started(e, cx);
})
.on_drag(MouseButton::Left, move |e, _, cx| {
let payload = payload.clone();
let render = render.clone();
DragAndDrop::<D>::dragging(e, payload, cx, render)
if e.end {
cx.update_global::<DragAndDrop<D>, _, _>(|drag_and_drop, cx| {
drag_and_drop.finish_dragging(cx)
})
} else {
let payload = payload.clone();
let render = render.clone();
DragAndDrop::<D>::dragging(e, payload, cx, render)
}
})
}
}