Comments (3)
果然是个老问题:#587
真巧咱俩最近都遇到了,我翻了一下源代码,应该是因为log.model
里面的限流逻辑window.requestAnimationFrame
的回调方法_flushLogs
里面的代码导致的。
我的log是一个interval性质的,调用destroy之后,log.model
的unbind
方法没有正确的屏蔽掉限流逻辑,但是又把Store
里的东西删了,导致限流回调触发后可能会去获取Store
里面的内容,但是获取的代码没做空保护,从而触发报错了。
这个改动的方法很多,比如在unbind
的时候清空logQueue
,比如增加一个flag来阻止限流回调的运行同时阻止addLog
的执行,比如在限流回调中获取store
的时候加一个空保护。
做一个空保护是最简单的,但是从代码设计的角度来说也许不是最优的。
from vconsole.
果然是个老问题:#587 真巧咱俩最近都遇到了,我翻了一下源代码,应该是因为
log.model
里面的限流逻辑window.requestAnimationFrame
的回调方法_flushLogs
里面的代码导致的。我的log是一个interval性质的,调用destroy之后,
log.model
的unbind
方法没有正确的屏蔽掉限流逻辑,但是又把Store
里的东西删了,导致限流回调触发后可能会去获取Store
里面的内容,但是获取的代码没做空保护,从而触发报错了。这个改动的方法很多,比如在
unbind
的时候清空logQueue
,比如增加一个flag来阻止限流回调的运行同时阻止addLog
的执行,比如在限流回调中获取store
的时候加一个空保护。做一个空保护是最简单的,但是从代码设计的角度来说也许不是最优的。
更正一下触发的原因,并不是因为interval性质的
log导致的,而是在destroy之前打一条log就可以必现这个报错。
from vconsole.
果然是个老问题:#587 真巧咱俩最近都遇到了,我翻了一下源代码,应该是因为
log.model
里面的限流逻辑window.requestAnimationFrame
的回调方法_flushLogs
里面的代码导致的。
我的log是一个interval性质的,调用destroy之后,log.model
的unbind
方法没有正确的屏蔽掉限流逻辑,但是又把Store
里的东西删了,导致限流回调触发后可能会去获取Store
里面的内容,但是获取的代码没做空保护,从而触发报错了。
这个改动的方法很多,比如在unbind
的时候清空logQueue
,比如增加一个flag来阻止限流回调的运行同时阻止addLog
的执行,比如在限流回调中获取store
的时候加一个空保护。
做一个空保护是最简单的,但是从代码设计的角度来说也许不是最优的。更正一下触发的原因,并不是因为
interval性质的
log导致的,而是在destroy之前打一条log就可以必现这个报错。
是的,我把关闭之前的log关了就不报错了。感谢
from vconsole.
Related Issues (20)
- v
- 从v3.14.0开始,请求会被拦截导致上传文件不成功
- 初始化失败
- [Feature Request]: 请求增加tool按钮的自定义class
- uni 运行到微信开发者工具会报错?哪位大神遇到过吗
- Analysis: 100% of dependency updates in this repository can be merged. HOT 1
- `reader.cancel` will not stop fetch stream
- 在webview中无法使用
- Unable to select text by mouse-dragging in iOS Safari
- 命令行输入样式有问题 HOT 2
- ssg项目中实例化Vconsole会报错ReferenceError: XMLHttpRequest is not defined HOT 1
- ssg项目中实例化Vconsole会报错ReferenceError: XMLHttpRequest is not defined
- 焦点在Log的command和filter时难以脱离并且此时滚动Log区域内容会消失 HOT 1
- CONTRIBUTING.md
- TUVyoyEgvxiRjKfPHoLWj6uFP2QLZ4XhHf
- smooth in this case meaning that the two labels with be partially rendered over each other causing it being illegible for the whole second.
- Uncaught TypeError: Cannot set property fetch of #<Window> which has only a getter
- Hi
- uniapp的vue2不支持吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vconsole.