Open 50431040 opened 1 year ago
@50431040 renderReactRoot
会初始化 React 并挂载 <AppWrapper>
,但这部分应该是异步的,一般不影响后续同步流程中 Object.create
创建 appObj
并赋值给 Current.app
。
目前我猜测可能影响的点:
Object.create
API 返回了 null
根据现有信息只能作一些推测,建议业务方看看能不能定位到具体机型和复现逻辑,或者魔改 dist/taro.js
的代码,当 Current.app
为 null
时,上报一些关键的变量及环境信息。
@50431040
renderReactRoot
会初始化 React 并挂载<AppWrapper>
,但这部分应该是异步的,一般不影响后续同步流程中Object.create
创建appObj
并赋值给Current.app
。目前我猜测可能影响的点:
- 赋值语句前存在报错。(如果你们的分析数据没有其他类似文件位置的报错,则应该不是)
Object.create
API 返回了null
根据现有信息只能作一些推测,建议业务方看看能不能定位到具体机型和复现逻辑,或者魔改
dist/taro.js
的代码,当Current.app
为null
时,上报一些关键的变量及环境信息。
据用户的反馈,现象是小程序白屏,后面重新进入又可以正常使用了。所以应该不是你说的这个原因,场景就是正常打开小程序,机型不是固定机型,基础库版本也不是固定的。不知道是不是低端手机容易复现。
[ONUNLOAD] () {
const $taroPath = this.$taroPath
// 触发onUnload生命周期
safeExecute($taroPath, ONUNLOAD)
unmounting = true
Current.app!.unmount!($taroPath, () => {
unmounting = false
instances.delete($taroPath)
if (pageElement) {
pageElement.ctx = null
pageElement = null
}
if (prepareMountList.length) {
prepareMountList.forEach(fn => fn())
prepareMountList = []
}
})
}
这里的 Current.app!.unmount
同样有报错:Cannot read properties of null (reading \'unmount\')
@50431040
renderReactRoot
会初始化 React 并挂载<AppWrapper>
,但这部分应该是异步的,一般不影响后续同步流程中Object.create
创建appObj
并赋值给Current.app
。 目前我猜测可能影响的点:
- 赋值语句前存在报错。(如果你们的分析数据没有其他类似文件位置的报错,则应该不是)
Object.create
API 返回了null
根据现有信息只能作一些推测,建议业务方看看能不能定位到具体机型和复现逻辑,或者魔改
dist/taro.js
的代码,当Current.app
为null
时,上报一些关键的变量及环境信息。据用户的反馈,现象是小程序白屏,后面重新进入又可以正常使用了。所以应该不是你说的这个原因,场景就是正常打开小程序,机型不是固定机型,基础库版本也不是固定的。不知道是不是低端手机容易复现。
那建议加一些上报信息的,暂时没有什么更好的思路了
根据错误开始出现的时间段,项目上的调整就是升级了React版本。
解决了吗
根据错误开始出现的时间段,项目上的调整就是升级了React版本。
这个问题依然存在,还都是android
相关平台
微信小程序
小程序基础库: 3.0.1 使用框架: React
复现步骤
本地未复现,但是We分析中有用户出现这个错误
期望结果
不报错
实际结果
报错
环境信息
补充信息
We分析提供的错误信息: Cannot read properties of null (reading \'mount\') TypeError: Cannot read properties of null (reading \'mount\') at pi. (https://taro.js:1:69387)
at o.safeCallback (https://lib/WASubContext.js:1:205075)
at o.call (https://lib/WASubContext.js:1:204860)
at t (https://lib/WASubContext.js:1:223261)
at f (https://lib/WASubContext.js:1:223586)
at d.pretendAttached (https://lib/WASubContext.js:1:235619)
at https://lib/WASubContext.js:1:421667
at ts (https://lib/WASubContext.js:1:421718)
at Module.ls (https://lib/WASubContext.js:1:422539)
at Lt.create (https://lib/WASubContext.js:1:463096)
对应的代码片段是:
通过上面这一串unicode,可以定位到对应源码位置: taro-runtime/src/dsl/common.ts,搜索unicode转换后的中文:【没有找到页面实例。】。代码片段如下所示:
由于Current.app为null导致的,Current.app的赋值在文件:taro-plugin-react/src/runtime/connect.ts
在小程序环境里面,createReactApp会调用renderReactRoot方法,最后会对Current.app赋值。 不知道是不是 renderReactRoot 和 Current.app = appObj 的执行顺序导致的这个错误,希望能够解答下!!(React版本是18.2.0)