Skip to content

Commit e72062a

Browse files
authored
Fix cleanup error (#2751)
Co-authored-by: TirlaP
1 parent 09c615d commit e72062a

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

src/addons/dragAndDrop/EventContainerWrapper.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { scrollParent, scrollTop } from 'dom-helpers'
2+
import qsa from 'dom-helpers/cjs/querySelectorAll'
13
import PropTypes from 'prop-types'
24
import React from 'react'
35
import { DnDContext } from './DnDContext'
4-
import { scrollParent, scrollTop } from 'dom-helpers'
5-
import qsa from 'dom-helpers/cjs/querySelectorAll'
66

77
import Selection, {
88
getBoundsForNode,
@@ -110,24 +110,6 @@ class EventContainerWrapper extends React.Component {
110110
this.update(event, newRange)
111111
}
112112

113-
_cleanupPreviewElements = () => {
114-
if (this.ref.current) {
115-
const previewElements = qsa(
116-
this.ref.current,
117-
'.rbc-addons-dnd-drag-preview'
118-
)
119-
previewElements.forEach((el) => {
120-
if (el.parentNode) {
121-
try {
122-
el.parentNode.removeChild(el)
123-
} catch (err) {
124-
// Ignore removal errors
125-
}
126-
}
127-
})
128-
}
129-
}
130-
131113
handleDropFromOutside = (point, boundaryBox) => {
132114
const { slotMetrics, resource } = this.props
133115

@@ -145,9 +127,8 @@ class EventContainerWrapper extends React.Component {
145127
resource,
146128
})
147129

130+
// Cleanup after dropping from outside
148131
this.reset()
149-
// Only call cleanup here, after dropping from outside
150-
this._cleanupPreviewElements()
151132
}
152133

153134
handleDragOverFromOutside = (point, bounds) => {

0 commit comments

Comments
 (0)