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

Taro.uploadFile上传图片后会在60s后调用fail和complete方法 #7448

Closed
pulei19960302 opened this issue Aug 26, 2020 · 2 comments
Closed
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-2 Version - 2.x

Comments

@pulei19960302
Copy link

相关平台

H5

复现仓库

https://github.com/pulei19960302/taro-issue
浏览器版本: Google 84
使用框架: React

复现步骤

1.点击上传图片,选择一个图片。
2.等待图片上传成功或者失败
3.等待60s后,uploadFile会再次执行fail和complete方法

期望结果

当图片上传失败是,只会执行一次fail和complete方法,当上传成功时候执行success和complete方法

实际结果

不轮上传成功或者失败。在等待60秒后都执行了complete方法和fail方法

环境信息

Taro CLI 2.0.7 environment info:
    System:
      OS: macOS 10.15.5
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.16.1 - /usr/local/bin/node
      Yarn: 1.22.0 - /usr/local/bin/yarn
      npm: 6.13.4 - /usr/local/bin/npm


补充信息

我查看了源码,在uploadFile.js中当send方法中创建了一个60�秒当定时器,并且只有在XMLHttpRequest中的onabort方法中清除了该定时器。

@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-2 Version - 2.x labels Aug 26, 2020
@luckyadam
Copy link
Member

可以来个 pr 哦

@pulei19960302
Copy link
Author

我看了一下代码。这个bug在2.2.7被修复。但只是在上传成功后清除了定时器。onerror和abort方法中没有清除,是否还需要pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-2 Version - 2.x
Projects
Archived in project
Development

No branches or pull requests

2 participants