Skip to content

和 vconsole 组合时上传超时报错 #18187

@dingtwo

Description

@dingtwo

请先确认

  • 我已搜索并确定这个提交不是重复的

Taro 版本

v3

相关领域

None

使用框架

React

相关平台

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 头条小程序
  • QQ 小程序
  • 钉钉小程序
  • 飞书小程序
  • 快手小程序

小程序基础库版本

No response

问题描述

和 vconsole 组合时能复现,逻辑上应该算是 taro 的 bug
请求的处理逻辑有问题,在触发超时 abort 之前先把回调函数都清了,vconsole 代理请求之后对 onabort 没有校验直接调用,导致抛异常

const send = () => {
xhr.send(form)

  const send = () => {
    xhr.send(form)
    timeoutInter = setTimeout(() => {
      xhr.onabort = null
      xhr.onload = null
      xhr.upload.onprogress = null
      xhr.onreadystatechange = null
      xhr.onerror = null
      abort()
      error({
        errMsg: `${apiName}:fail timeout`
      })
    }, timeout || NETWORK_TIMEOUT)
  }

复现链接

https://code.juejin.cn/pen/7538686660536434698

复现步骤

项目中同时引用 vconsole,上传时触发超时即可复现

环境信息

所有环境

开源贡献

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-reactFramework - ReactT-alipayTarget - 编译到支付宝小程序T-ddT-feishuT-h5Target - 编译到 H5T-harmonyTarget - 编译到 HarmonyT-harmony_hybridTarget - 编译到 Harmony (Hybird 模式)T-jdTarget - 编译到京东小程序T-kwaiT-qqTarget - 编译到 QQ 小程序T-quickappTarget - 编译到快应用T-qyT-rnTarget - 编译到 React NativeT-swanTarget - 编译到百度小程序T-ttTarget - 编译到字节跳动小程序T-weappTarget - 编译到微信小程序V-3Version - 3.xbugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Status

    Padding

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions