Skip to content

Commit e8609af

Browse files
authored
fix: dnd freezes an event intermittently (jquense#1631)
* Fixed an issue where dnd freezes an event intermittently * Make sure OnEnd is called no matter if it's being dragged
1 parent c31639a commit e8609af

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/addons/dragAndDrop/EventContainerWrapper.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class EventContainerWrapper extends React.Component {
133133

134134
_selectable = () => {
135135
let node = findDOMNode(this)
136+
let isBeingDragged = false
136137
let selector = (this._selector = new Selection(() =>
137138
node.closest('.rbc-time-view')
138139
))
@@ -177,16 +178,22 @@ class EventContainerWrapper extends React.Component {
177178
this.handleDropFromOutside(point, bounds)
178179
})
179180

180-
selector.on('selectStart', () => this.context.draggable.onStart())
181+
selector.on('selectStart', () => {
182+
isBeingDragged = true
183+
this.context.draggable.onStart()
184+
})
181185

182186
selector.on('select', point => {
183187
const bounds = getBoundsForNode(node)
184-
188+
isBeingDragged = false
185189
if (!this.state.event || !pointInColumn(bounds, point)) return
186190
this.handleInteractionEnd()
187191
})
188192

189-
selector.on('click', () => this.context.draggable.onEnd(null))
193+
selector.on('click', () => {
194+
if (isBeingDragged) this.reset()
195+
this.context.draggable.onEnd(null)
196+
})
190197

191198
selector.on('reset', () => {
192199
this.reset()

0 commit comments

Comments
 (0)