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

微信小程序插件开发默认模板,在插件页面点击Button报错Cannot read property 'unstable_batchedUpdates' of undefined #11241

Closed
fw6 opened this issue Feb 8, 2022 · 1 comment · Fixed by #11278
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@fw6
Copy link
Contributor

fw6 commented Feb 8, 2022

相关平台

微信小程序

小程序基础库: 2.22.0
使用框架: React

复现步骤

  1. 使用taro init创建一个全新项目,选择 react、typescript、sass,模板选择 wxplugin
  2. 修改project.config.json的两个字段分别为 "miniprogramRoot": "miniprogram/", "pluginRoot": "plugin/"
  3. package.json 添加新的script: "dev:wxplugin": "taro build --plugin weapp --watch"
  4. list.tsx文件中添加一行 <Button>Click me</Button>,Button从@tarojs/components引入(从taroify引入的组件也有该问题).
  5. 命令行执行yarn dev:wxplugin. 使用微信小程序开发者工具打开miniprogram目录
  6. 点击go to pages/list进入插件页面,点击添加的按钮,在控制台可见报错信息

期望结果

无报错。

实际结果

点击Button后,控制台出现报错. (Mac、windows皆有该问题)

VM47 WAService.js:2 TypeError: Cannot read property 'unstable_batchedUpdates' of undefined
    at Hooks.hooks$1.batchedEventUpdates (taro.js:245)
    at ji.eventHandler [as eh] (taro.js:6172)
    at Object.i.safeCallback (VM47 WAService.js:2)
    at VM47 WAService.js:2
    at b (VM47 WAService.js:2)
    at VM47 WAService.js:2
    at VM47 WAService.js:2
    at i (VM8 asdebug.js:1)
    at c (VM8 asdebug.js:1)
    at VM8 asdebug.js:1(env: macOS,mp,1.05.2110290; lib: 2.22.0)

环境信息


Taro CLI 3.4.0 environment info:
    System:
      OS: macOS 12.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.18.2 - ~/.volta/tools/image/node/14.18.2/bin/node
      Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
      npm: 6.14.15 - ~/.volta/tools/image/node/14.18.2/bin/npm
    npmPackages:
      @tarojs/components: 3.4.0 => 3.4.0 
      @tarojs/mini-runner: 3.4.0 => 3.4.0 
      @tarojs/react: 3.4.0 => 3.4.0 
      @tarojs/runtime: 3.4.0 => 3.4.0 
      @tarojs/taro: 3.4.0 => 3.4.0 
      @tarojs/webpack-runner: 3.4.0 => 3.4.0 
      babel-preset-taro: 3.4.0 => 3.4.0 
      eslint-config-taro: 3.4.0 => 3.4.0 
      react: ^17.0.0 => 17.0.2 

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Feb 8, 2022
@fw6
Copy link
Contributor Author

fw6 commented Feb 8, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
2 participants