-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
fix:delay folder upload until all children files are parsed when drag #561
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@zombieJ 有空看看 |
感觉计数器这个不太适合,对于文件夹遍历有太多 edge case 容易导致不归零而无法上传。对于过去的实现是即便有失败的,也是能上传。所以如果是要改成 batch flush 的话,我建议是换成队列实现:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #561 +/- ##
==========================================
+ Coverage 87.21% 88.72% +1.50%
==========================================
Files 6 6
Lines 266 275 +9
Branches 72 76 +4
==========================================
+ Hits 232 244 +12
+ Misses 34 31 -3 ☔ View full report in Codecov by Sentry. |
ant-design/ant-design#49252 可以安全的close么? |
我觉得没啥问题,可以问问豆酱大佬 |
小事不用问他,我们专门来代劳小事的。我去关了。 |
发的 minor 版本,辛苦去antd的feature分支再提交个PR? |
听不太懂,要怎么弄呢 |
就是 package.json 版本拉上去 |
好 |
🔗 相关 Issue
ant-design/ant-design#49252
#453
ps:之前提过pr,但是commit记录太乱了,大佬后面也没看就重新开了一个
💡 需求背景和解决方案
当拖拽上传文件夹时,需要手动解析文件树,原代码在解析到子文件为非文件夹时直接执行后续而非等待全部文件解析完成,与普通上传的表现不一致。添加其他变量确保文件全部解析后再进行后续操作
主要改动的地方:
1.traverseFileTree.ts中添加restFile变量记录剩余文件数量,将原本的loopFiles函数移动到了traverseFileTree里便于访问restFile变量
2.原测试中工具函数makeFileSystemEntry逻辑错误,导致当上传的文件夹包含子文件夹时无法进入开始上传逻辑,在测试 https://github.com/react-component/upload/blob/master/tests/uploader.spec.tsx#L377 将webp后缀改成png后测试任然通过可以验证这个bug
3.添加了相关测试