NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.66k stars 4.8k forks source link

onLaunch lifecycle is not working on Taro 3.5.0 #12141

Closed smoothdvd closed 2 years ago

smoothdvd commented 2 years ago

相关平台

微信小程序

复现仓库

https://github.com/smoothdvd/taro-issues.git demo codes is in onlaunch branch 小程序基础库: 2.25.2 使用框架: React

复现步骤

  1. Launch wechat mini-program by wechat devtools;
  2. Check console tab of wechat devtools;
  3. No console out which in onLaunch();
  4. Screenshot from 2022-07-28 09-39-06

期望结果

Executes codes in onLaunch()

实际结果

Not executes codes in onLaunch()

环境信息

👽 Taro v3.5.0

  Taro CLI 3.5.0 environment info:
    System:
      OS: Linux 5.17 Manjaro Linux undefined
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
      Yarn: 1.22.19 - /usr/bin/yarn
      npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
    npmPackages:
      @tarojs/cli: 3.5.0 => 3.5.0 
      @tarojs/components: 3.5.0 => 3.5.0 
      @tarojs/helper: 3.5.0 => 3.5.0 
      @tarojs/plugin-framework-react: 3.5.0 => 3.5.0 
      @tarojs/plugin-platform-alipay: 3.5.0 => 3.5.0 
      @tarojs/plugin-platform-jd: 3.5.0 => 3.5.0 
      @tarojs/plugin-platform-qq: 3.5.0 => 3.5.0 
      @tarojs/plugin-platform-swan: 3.5.0 => 3.5.0 
      @tarojs/plugin-platform-tt: 3.5.0 => 3.5.0 
      @tarojs/plugin-platform-weapp: 3.5.0 => 3.5.0 
      @tarojs/react: 3.5.0 => 3.5.0 
      @tarojs/router: 3.5.0 => 3.5.0 
      @tarojs/runtime: 3.5.0 => 3.5.0 
      @tarojs/shared: 3.5.0 => 3.5.0 
      @tarojs/taro: 3.5.0 => 3.5.0 
      @tarojs/taro-h5: 3.5.0 => 3.5.0 
      babel-preset-taro: 3.5.0 => 3.5.0 
      eslint-config-taro: 3.5.0 => 3.5.0 
      react: ^18.0.0 => 18.2.0

补充信息

Chen-jj commented 2 years ago

同样是 React18 createRoot API 异步挂载导致的竞态问题,https://github.com/NervJS/taro/issues/12129#issuecomment-1196594823