Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging between two (H5) grids sometimes does not remove underlying node #1612

Closed
infime opened this issue Feb 3, 2021 · 2 comments
Closed

Comments

@infime
Copy link
Contributor

infime commented Feb 3, 2021

Subject of the issue

Moving an item between two grids is not behaving as expected and leaving behind underlying nodes in the source grids engine. This is possibly related to / could be solved by containment being implemented in H5 dd.

Your environment

  • 3.3.0 H5
  • Chrome 86.0.4240.111

Steps to reproduce

Reproducable on https://gridstackjs.com/demo/two.html# by dragging an item from the left grid to the right grid, with the mouse somewhere on the right side of the item. This seems to occasionally trigger a race condition that causes and a placeholder for the item in both grids simultaneously.

Expected behavior

The underlying node should be correctly removed from the original grid.

Actual behavior

  • gridstack.engine.nodes of the left grid does not remove the item.
  • save() of the left grid contains the removed element.
  • If the item is dropped back into the left grid, gridstack.engine.nodes will have duplicated the item. Causing strange resize/move and save()/load() behavior.
@adumesny
Copy link
Member

adumesny commented Feb 3, 2021

does this happen if jq version is used ? wonder if this was introduced recently...

I ran into this last night while debugging/fixing #1578 , which is related to long standing #393

adumesny added a commit to adumesny/gridstack.js that referenced this issue Mar 8, 2021
- fix gridstack#393 gridstack#1612 gridstack#1578
- re-write of the **drag in/out code - fixing 5 years old bug**
1. we now remove item when cursor leaves (`acceptWidgets` case using `dropout` event) or shape is outside (re-using same method) and re-insert on cursor enter (since we only get `dropover` event). Should **not be possible to have 2 placeholders** which confuses the grids.
2. major re-write and cleanup of the drag in/out. Vars have been renamed and fully documented as I couldn't understand the legacy buggy code.
3. removed any over trash delay feedback as I don't see the point and could introduce race conditions.
adumesny added a commit to adumesny/gridstack.js that referenced this issue Mar 8, 2021
- fix gridstack#393 gridstack#1612 gridstack#1578
- re-write of the **drag in/out code - fixing 5 years old bug**
1. we now remove item when cursor leaves (`acceptWidgets` case using `dropout` event) or shape is outside (re-using same method) and re-insert on cursor enter (since we only get `dropover` event). Should **not be possible to have 2 placeholders** which confuses the grids.
2. major re-write and cleanup of the drag in/out. Vars have been renamed and fully documented as I couldn't understand the legacy buggy code.
3. removed any over trash delay feedback as I don't see the point and could introduce race conditions.
@adumesny adumesny mentioned this issue Mar 8, 2021
3 tasks
@adumesny
Copy link
Member

adumesny commented Mar 8, 2021

fixed in v4 (complete re-write)

@adumesny adumesny closed this as completed Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants