简体   繁体   English

为什么在订阅我的选择器 observable 时看不到来自 NGRX 的初始值?

[英]Why can't I see the initialvalues from NGRX when subscribing to my selector observable?

I have a NGRX application and I can't see it working with the selector.我有一个 NGRX 应用程序,但我看不到它与选择器一起工作。 It doesn't show the initialvalues I put in the reducer.它没有显示我放入减速器的初始值。 It only shows value after I dispatch an Action.它仅在我发送 Action 后才显示价值。 Why I can't see the initialValue from the observable?为什么我看不到 observable 中的 initialValue?

Here is the code:这是代码:

exportLoading$ = this._store.pipe(select(selectImbalanceDetailsExportLoading));

ngOnInit(): void {
   exportLoading$.subscribe(x=> console.log(x));
}

Would be nice to see how you init the state, might you share it?很高兴看到你如何初始化 state,你能分享一下吗?

Also people say the next possible reasons:人们还说下一个可能的原因:

the reducer of the missing property had no default case for the actions, so it was returning undefined And for the empty object, I think it is just store-devtools that hide property with undefined value.缺少属性的减速器没有默认情况下的动作,所以它返回未定义对于空的 object,我认为只是 store-devtools 隐藏了具有未定义值的属性。

Info is taken from here: https://github.com/ngrx/platform/issues/1086#issuecomment-391373866信息取自这里: https://github.com/ngrx/platform/issues/1086#issuecomment-391373866

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 订阅可观察对象时无法正确分配对象 - Can't properly assign object when subscribing to observable 从 ngrx store pipe 选择器返回 Observable - Return Observable from ngrx store pipe selector 为什么订阅返回 FireStore 文档快照列表的 Observable 我无法构建正确的对象列表? 我获得未定义的对象 - Why subscribing an Observable returning a list of FireStore document snapshot I can't build a proper list of objects? I obtain undefined objects 我无法访问从 Ngrx 实体选择器获取的数据的字段值 - I can't access fields values of data fetched from Ngrx entities selector 如何通过订阅 Observable 来过滤 ID - How can I filter an ID by subscribing to an Observable 如何从ngrx选择器中获取可观察的原始数据 - How to get raw data from observable getting from ngrx selector NgRx 选择器 - 冷或热可观察 - NgRx Selector - cold or hot observable 如何从ngrx选择器Observable访问嵌套属性? - How to access nested property from ngrx selector Observable? 来自返回多种类型的 ngrx 选择器的可观察类型错误 - Observable type error from ngrx selector that returns multiple types 在 Ionic 4 中,来自商店选择器的 observable 不会刷新 UI? 为什么? - In Ionic 4, an observable from a store selector doesn’t refresh the UI ! Why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM