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

[Table]行拖拽排序顺序不符合预期(Vue2 和 React 没有问题,单 Vue3 的数据驱动较为奇怪) #915

Closed
benbenonline opened this issue May 31, 2022 · 10 comments
Assignees
Labels
to be published to be published

Comments

@benbenonline
Copy link

重现链接

https://tdesign.tencent.com/vue-next/components/table#%E5%8F%AF%E6%8B%96%E6%8B%BD%E6%8E%92%E5%BA%8F%E7%9A%84%E8%A1%A8%E6%A0%BC

重现步骤

官方例子也可以重现
示例二:有手柄列的行拖拽排序
步骤:
多次拖拽JQTest1行向上或向下,重复操作。

期望结果

多次拖拽JQTest1行向上或向下后,排序顺序正确

实际结果

顺序会乱掉,不是期望的正确排序结果。

补充说明

从0.13.0到目前最新版本0.15.3的官方例子,问题依旧

Environment Info
相关版本 0.13.0
框架版本 / 基础库版本 Vue3(3.2.25)
系统、浏览器 Chromium: 80.0.3987.163 Res: 2106.482
Node版本
@github-actions
Copy link
Contributor

👋 @benbenonline,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@github-actions
Copy link
Contributor

github-actions bot commented May 31, 2022

♥️ 有劳 @realyuyanan @Louiszhai @PengYYYYY @chaishi 尽快确认问题。
确认有效后将下一步计划和可能需要的时间回复给 @benbenonline

@chaishi
Copy link
Collaborator

chaishi commented May 31, 2022

问题已知,拖拽排序插件 和 Vue3 混合使用有问题。

跟 Vue2 和 React 配合使用没有问题。(目前初步估计是 Vue3 对节点有特殊的处理,也不排除是 BUG 的可能)

我上个周末,看了一整天这个问题,没看出来怎么处理。Vue3 的数据驱动有点让人费解,如下图所示。明明数据已经更新为新的顺序,但是 Vue3 的渲染结果却不是同步的。

wecom-temp-44ef846471196cd4a576ec627196b0f7

Vue3 仓库 issue:vuejs/core#4010

这里也有一个关于节点顺序的讨论,可以同步关注下

@benbenonline
Copy link
Author

问题已知,拖拽排序插件 和 Vue3 混合使用有问题。

跟 Vue2 和 React 配合使用没有问题。(目前初步估计是 Vue3 对节点有特殊的处理,也不排除是 BUG 的可能)

我上个周末,看了一整天这个问题,没看出来怎么处理。Vue3 的数据驱动有点让人费解,如下图所示。明明数据已经更新为新的顺序,但是 Vue3 的渲染结果却不是同步的。

wecom-temp-44ef846471196cd4a576ec627196b0f7

Vue3 仓库 issue:vuejs/core#4010

这里也有一个关于节点顺序的讨论,可以同步关注下

了解了,谢谢回复,我本地也是如此:响应式数组顺序已经为正确的顺序,但是渲染节点的顺序不同步,而且我手动多次触发重绘,顺序还是会有问题。
后面我打算尝试仅使用vue3的场景下实现个简单拖拽表格demo,再做下验证看看,排查下vue3的触发渲染过程哪里有问题,谢谢。

@benbenonline benbenonline closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2022
@chaishi
Copy link
Collaborator

chaishi commented May 31, 2022

确实是一个问题,在问题解决之前,issue 继续保持 open 状态,我们也会持续关注 Vue3 官方动态

@chaishi chaishi reopened this May 31, 2022
@chaishi chaishi changed the title [Table]行拖拽多次,顺序乱掉 [Table]行拖拽多次,顺序乱掉(Vue2 和 React 没有问题,单 Vue3 的数据驱动较为奇怪,研究中)欢迎有兴趣的同学共同探讨 May 31, 2022
@benbenonline
Copy link
Author

benbenonline commented Jun 2, 2022

目前比较笨的临时解决方案,对row-key的设置不使用后台接口返回的id,而是在前端对应的viewmodel class上添加_id,由前端生成uuid或nanoid,每次做拖拽排序后,重新给_id进行赋值,触发表格的整体重绘,这样有一定的性能损耗。

@benbenonline benbenonline reopened this Jun 2, 2022
@chaishi chaishi changed the title [Table]行拖拽多次,顺序乱掉(Vue2 和 React 没有问题,单 Vue3 的数据驱动较为奇怪,研究中)欢迎有兴趣的同学共同探讨 [Table]行拖拽排序顺序不符合预期(Vue2 和 React 没有问题,单 Vue3 的数据驱动较为奇怪,研究中)欢迎有兴趣的同学共同探讨 Jun 5, 2022
@benbenonline benbenonline reopened this Jun 6, 2022
@chaishi
Copy link
Collaborator

chaishi commented Jul 2, 2022

#893
#895

@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2022

这个 Issue 被标记为了过时 stale ,因为它已经持续 30 天没有任何活动了。删除 stale 标签或评论,否则将在 7 天内关闭。

@github-actions
Copy link
Contributor

此 Issue 被自动关闭,因为它自被标记为过时 stale 以来已闲置 7 天。

@chaishi
Copy link
Collaborator

chaishi commented Dec 4, 2022

针对 Vue3 特殊处理
resolved in #2105 d1fc583

@chaishi chaishi changed the title [Table]行拖拽排序顺序不符合预期(Vue2 和 React 没有问题,单 Vue3 的数据驱动较为奇怪,研究中)欢迎有兴趣的同学共同探讨 [Table]行拖拽排序顺序不符合预期(Vue2 和 React 没有问题,单 Vue3 的数据驱动较为奇怪) Dec 4, 2022
@chaishi chaishi added to be published to be published and removed 🪨 Stale labels Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to be published to be published
Projects
None yet
Development

No branches or pull requests

3 participants