I seem to be running into some subtleties around the order of DOM events firing and components being removed/destroyed that have me fairly confused. I'm trying to fix an issue with the ember-drag-drop library, where, if the draggable component is removed because of a change is made in the drop event handler, then the lib's drag coordinator service to be left in a weird state
full issue is here: https://github.com/mharris717/ember-drag-drop/issues/118
the gist of it is that the browser fires dragStart
-> drop
-> dragEnd
, but Ember seems to be removing the component before the dragEnd
handler has a chance to fire. To work around this, I added the cleanup to the willDestroyElement
hook (only performed if the element is currently being dragged), which seems to work... except now, for some reason, after the cleanup is performed in willDestroyElement
, the endDrag
hook does (usually?) fire, resulting in cleanup being performed a second time, which in turn causes a backtracking render error.
I can work around this by adding some logic to only perform the cleanup if it hasn't yet been done, but would really like to understand why this is occurring
  MCVE that demonstrates the original problem is here: https://ember-twiddle.com/155776d5af6dd8b662fea9a914921329
Aucun commentaire:
Enregistrer un commentaire