我在https://github.com/ngrx/platform/tree/master/docs/store-devtools上读过极简主义的文档,并且理解您可以按以下方式添加工具:
StoreDevtoolsModule.instrument({
logOnly: environment.production
})据推测,如果logOnly标志为真,您的应用程序将以只日志模式连接到Redux DevTools扩展,它的开销很小,因为它不应该存储状态数据,而应该只记录运行时期间发生的操作名。
但是在我的实验中,我仍然看到ngrx DevTools面板中的状态数据,那么使用logOnly:true的好处是什么?
发布于 2018-03-05 08:57:51
根据文献资料
logOnly:布尔-连接到纯日志模式下的Devtools扩展。默认值为false,它启用了所有扩展功能。
具有指向扩展特性的链接。
基于此,我们可以假设将logOnly设置为true将关闭以下redux扩展特性:
const composeEnhancers = composeWithDevTools({
features: {
pause: true, // start/pause recording of dispatched actions
lock: true, // lock/unlock dispatching actions and side effects
persist: true, // persist states on page reloading
export: true, // export history of actions in a file
import: 'custom', // import history of actions from a file
jump: true, // jump back and forth (time travelling)
skip: true, // skip (cancel) actions
reorder: true, // drag and drop actions in the history list
dispatch: true, // dispatch custom actions or action creators
test: true // generate tests for the selected actions
}
})这对于生产环境来说是非常理想的,因为您可能不需要或不希望这些主要以开发为中心的特性在您的实际应用程序中运行。
发布于 2020-12-11 10:58:52
使用logOnly 的保证了状态的完整性。
当动作调度器被关闭时,您不能修改它。在纯日志模式下,您可以查看日志,但不能修改它。
https://stackoverflow.com/questions/49028979
复制相似问题