React-dnd: 删除悬停时拖动的元素将引发“预期找到有效目标”。

创建于 2016-01-24  ·  14评论  ·  资料来源: react-dnd/react-dnd

嗨,大家好,

我目前无法发布特定的代码示例,因为它目前太混乱了,但我认为我已经隔离了重现此问题所需的步骤。

  • 开始拖动
  • 悬停在拖动的项目上(该项目同时处于拖放和拖动状态)

    • 删除与拖动项目相对应的状态

该错误抛出在DragDropMonitor.prototype.canDropOnTarget
因为它无法找到带有targetID的目标(显然)。

用例:我正在构建可排序的树,我需要重新放置拖动和悬停的项目
到其父节点之后:

  • 如果它是嵌套列表中的最后一项
  • 并且悬停的项目在左侧具有水平偏移
    (树的正常行为:http://pqx.github.io/react-ui-tree/)

还有更多的事情:虽然发生错误,但仍然可以解决。

谢谢!

最有用的评论

这里同样的问题

image

所有14条评论

+1我也遇到这个问题

请提供一个重现该问题的示例。 那我看看

这可能在2.1.0中已修复。
我将关闭,但如果没有请通知我,然后我将重新开放。

@gaearon我最近升级到react-dnd v5,此问题再次被复制。 似乎它在2.6.03.0.2但是在4.0.55.0.0

有什么消息吗?

@gaearon有更新吗?

这里同样的问题

5.0.0

这里同样的问题

这里同样的问题

image

同样的问题,有什么修复建议吗?

有人有运气吗?

我在react-sortable-tree外部源样本上遇到此问题。 拖到红色区域。

https://frontend-collective.github.io/react-sortable-tree/?path=/story/advanced --drag-from-external-source
https://github.com/frontend-collective/react-sortable-tree/blob/master/stories/external-node.js

vendors~main.91acd83f50dfbcb80997.bundle.js:1 Uncaught Invariant Violation: Expected to find a valid target. at module.exports (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:592) at DragDropMonitorImpl.canDropOnTarget (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:186636) at DropTargetMonitorImpl.canDrop (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:71541) at https://frontend-collective.github.io/react-sortable-tree/main.91acd83f50dfbcb80997.bundle.js:1:132866 at DragDropContainer.getCurrentState (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:87049) at DragDropContainer._this.handleChange (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:84210) at handleChange (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:185746) at dispatch (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:168058) at Object.endDrag (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:199234) at HTML5Backend.handleTopDragEndCapture (https://frontend-collective.github.io/react-sortable-tree/vendors~main.91acd83f50dfbcb80997.bundle.js:2:152270)

此页面是否有帮助?
0 / 5 - 0 等级