clauderic / clauderic/react-sortable-hoc

Dragged element renders with stale props during drag

Open
#754 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

When dragging an element, the element does not re-render even if props change while it is being dragged.

I'm not sure if it has something to do with the way the floating dragged element that follows the mouse is rendered, but that is the item that does not re-render even when it should.

If I set the `hideSortableGhost` to `false`, the non-animated item does get re-rendered appropriately, so my guess is the floating dragged item is some sort of snapshot of the item on drag start.

### Reproduction
https://codesandbox.io/s/react-sortable-hoc-stale-props-on-drag-jjeoz

I included a use case in the codesandbox, in which an item has to render some "separator" or "joining" UI to join it to the list item above it, only if there is one. I want to reflect this condition visually as soon as the user starts dragging, which in practice means that "separator" component should get shown and hidden if a list item becomes/stops being the first item in the list.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.