-
-
Notifications
You must be signed in to change notification settings - Fork 832
Replace TagPanel react-dnd with react-beautiful-dnd #1705
Conversation
This new library handles the simple case of an ordered vertical (or horizontal) list of items that can be reordered. It provides animations, handles positioning of items mid-drag and exposes a much simpler API to react-dnd (with a slight loss of potential function, but we don't need this flexibility here anyway). Apart from this, TagOrderStore had to be changed in a highly coupled way, but arguably for the better. Instead of being updated incrementally every time an item is dragged over another and having a separate "commit" action, the asyncronous action `moveTag` is used to reposition the tag in the list and both dispatch an optimistic update and carry out the request as before. (The MatrixActions.accountData is still used to indicate a successful reordering of tags). The view is updated instantly, in an animated way, and this is handled at the layer "above" React by the DND library.
And for once Travis CI is being annoying and isn't starting chrome |
This fixes element-hq/element-web#5910 and element-hq/element-web#5912 This also probably fixes element-hq/element-web#5839 |
.travis.yml
Outdated
@@ -3,7 +3,9 @@ dist: trusty | |||
|
|||
# we don't need sudo, so can run in a container, which makes startup much | |||
# quicker. | |||
sudo: false | |||
# | |||
# unfortunately we do require sudo as per https://github.com/travis-ci/travis-ci/issues/8836 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temporarily, hopefully?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point they should fix the issue, sure.
otherwise lgtm |
Having tested this locally again, it seems clicking TagPanel doesn't deselect all tags. Will fix here. |
For some reason, after dragging an item the parent draggable receives a mouse click. The workaround is to use onMouseDown for deselecting tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but please comment hacky workaround like this, ideally referencing the upstream bug in question, filing a new one if one doesn't already exist.
yep, sure, sorry totally blanked on that one. |
This new library handles the simple case of an ordered vertical
(or horizontal) list of items that can be reordered.
It provides animations, handles positioning of items mid-drag
and exposes a much simpler API to react-dnd (with a slight loss
of potential function, but we don't need this flexibility here
anyway).
Apart from this, TagOrderStore had to be changed in a highly
coupled way, but arguably for the better. Instead of being
updated incrementally every time an item is dragged over
another and having a separate "commit" action, the
asyncronous action
moveTag
is used to reposition the tag inthe list and both dispatch an optimistic update and carry out
the request as before. (The MatrixActions.accountData is still
used to indicate a successful reordering of tags).
The view is updated instantly, in an animated way, and this
is handled at the layer "above" React by the DND library.