fix: prevent duplicate __dropping-elem__ from race condition in handleDragOver
When handleDragOver and handleDragLeave fire in quick succession, a race condition can cause duplicate __dropping-elem__ IDs in the layout, leading to infinite recursion in resolveCompactionCollision. The race condition occurs because: 1. handleDragOver calls setLayout([...layoutRef.current, droppingItem]) and setDroppingDOMNode(<div/>) — both batched by React 2. handleDragLeave fires before React renders, calling removeDroppingPlaceholder() which checks layoutRef.current 3. layoutRef.current hasn't updated yet (stale), so hasDroppingItem is false — early return sets droppingDOMNode=null without filtering the layout 4. After React renders: layout contains __dropping-elem__ but droppingDOMNode is null 5. Next handleDragOver enters the if(!droppingDOMNode) branch and adds a second __dropping-elem__ to layoutRef.current Fix: filter out any existing dropping element from layoutRef.current before adding the new one in handleDragOver.
W
WhiteMind committed
e4bc3accdb809e680bdcd56d4eaa390c1b44a4e8
Parent: d4bb483