Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Replace TagPanel react-dnd with react-beautiful-dnd #1705

Merged
merged 6 commits into from
Jan 16, 2018

Conversation

lukebarnard1
Copy link
Contributor

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.

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.
@lukebarnard1
Copy link
Contributor Author

And for once Travis CI is being annoying and isn't starting chrome

@lukebarnard1
Copy link
Contributor Author

lukebarnard1 commented Jan 16, 2018

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporarily, hopefully?

Copy link
Contributor Author

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.

@dbkr
Copy link
Member

dbkr commented Jan 16, 2018

otherwise lgtm

@dbkr dbkr assigned lukebarnard1 and unassigned dbkr Jan 16, 2018
@lukebarnard1
Copy link
Contributor Author

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
@lukebarnard1 lukebarnard1 assigned dbkr and unassigned lukebarnard1 Jan 16, 2018
Copy link
Member

@dbkr dbkr left a 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.

@lukebarnard1
Copy link
Contributor Author

please comment hacky workaround like this

yep, sure, sorry totally blanked on that one.

@lukebarnard1 lukebarnard1 merged commit 62caa4f into develop Jan 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants