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

[miniprogram-render] 线上遇到异常: Cannot read property '$$trigger' of null #481

Open
backrunner opened this issue Oct 11, 2024 · 6 comments

Comments

@backrunner
Copy link

image image

监控到有比较多这一类错误,概率出现,不太确定是否是什么时序异常,相关组件是用时注入的

@JimmyVV
Copy link
Contributor

JimmyVV commented Oct 11, 2024 via email

@backrunner
Copy link
Author

已经收到哦~~~~

请问这里找不到window.document的问题有什么我们可以尝试的排查方向吗?或者可以mail我企业微信内部详聊也行~

@JuneAndGreen
Copy link
Collaborator

JuneAndGreen commented Oct 29, 2024

用时注入是说小程序的懒加载/懒注入?kbone 里的自定义组件只有 miniprogram-element,所以没有支持。

如果是指 vue 之类框架的用时注入,这个没有直接支持。在小程序中业务代码都会打包进代码包中,除了分包外目前没有支持其他的异步加载逻辑。

@backrunner
Copy link
Author

排查了一圈疑似是我们封装的问题,暂时先close

@backrunner
Copy link
Author

Reopen 一下这个问题,在 mp-webpack-pluginpage.base.tmpl.js 中,L109 对 this.document 置为 null

if (!this.isPage) this.onUnload()

但是对于 miniprogram-render 这里的方法,如果存在销毁过程中或销毁之前调用了 setData,且满足回调内的判断条件,可能会读到空的 window.document。这里的 window 是提前取出的,但是回调可能后触发,存在一定的时序问题。

window.document.$$trigger('DOMContentLoaded')

@JuneAndGreen 辛苦再帮看看。

@backrunner backrunner reopened this Feb 20, 2025
@JimmyVV
Copy link
Contributor

JimmyVV commented Feb 20, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants