react-component / upload

React Upload
https://upload.react-component.vercel.app/
MIT License
776 stars 317 forks source link

feat: support concurrency limit #541

Closed thep0y closed 8 months ago

thep0y commented 8 months ago

relate: https://github.com/ant-design/ant-design/issues/28950

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
upload ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2024 3:58am
afc163 commented 8 months ago

@MadCcc 看看

codecov[bot] commented 8 months ago

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (6027d4c) 87.21% compared to head (050b5fb) 82.91%.

:exclamation: Current head 050b5fb differs from pull request most recent head bae65e1. Consider uploading reports for the commit bae65e1 to get more accurate results

Files Patch % Lines
src/asyncPool.ts 0.00% 13 Missing :warning:
src/AjaxUploader.tsx 85.71% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #541 +/- ## ========================================== - Coverage 87.21% 82.91% -4.30% ========================================== Files 6 7 +1 Lines 266 281 +15 Branches 72 76 +4 ========================================== + Hits 232 233 +1 - Misses 34 48 +14 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

afc163 commented 8 months ago

看上去得补一些用例,测试覆盖率下降了。

thep0y commented 8 months ago

早上试了一下,xhr 请求虽然是异步的不受异步控制,asyncPool没有发挥作用,需要使用别的方式实现,是否考虑将请求方法改用fetch

afc163 commented 8 months ago
  1. xhr 改 fetch 变动会比较大,我不建议为了加新特性动底层。
  2. 上传逻辑的自定义最灵活的方式是 customRequest,所以是不是做个内置的 concurrencyRequest 方便开发者直接使用就好?
thep0y commented 8 months ago
  1. xhr 改 fetch 变动会比较大,我不建议为了加新特性动底层。
  2. 上传逻辑的自定义最灵活的方式是 customRequest,所以是不是做个内置的 concurrencyRequest 方便开发者直接使用就好?

方式 2 确实可能更好。

thep0y commented 8 months ago

换种方式实现