pcww / builder

0 stars 0 forks source link

Changing strip order sometimes not in sync #52

Closed brian-slate closed 6 years ago

brian-slate commented 7 years ago

Noticed I'm seeing ordering issues when dragging strips around. Not sure how exactly to repro, but if you move a couple around quickly drop then, then another quickly it seems fairly easy to "trick" the UI. Not sure if the virtual board is off, or the ui is off.

trezy commented 7 years ago

This issue is caused by our Backbone collection falling out of sync with what's in the UI. There are two things I think will at least help, if not outright fix this bug.

  1. Use the Backbone Collection's splice method instead of doing all the heavy lifting in the UI.
  2. Switch over to using a queue. Instead of doing all of the reordering based on the Sortable plugin's events -- which I hypothesize may be causing race conditions -- use those events to push changes into a queue that is executed in order. Use requestAnimationFrame for executing the changes in the queue.
brian-slate commented 6 years ago

Reimplemented dragdrop using react-sortable-hoc. It was painful.