Cannot read property from Map that is a signal #4341
-
Which @ngrx/* package(s) are the source of the bug?signals, store Minimal reproduction of the bug/regression with instructionsThis is my Signal Store When in the component I call this.filterModalStore.entireMap(), I can see the full map I really cannot see where I'm going wrong...
Expected behaviorSee above Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)"@ngrx/operators": "^17.2.0", Other informationNo response I would be willing to submit a PR to fix this issue
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 10 replies
-
@dreamstar-enterprises, here's a link for a Stackblitz that is set up with the SignalStore. Please use that and paste the link here. https://stackblitz.com/edit/ngrx-signal-store-starter Would help a lot. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thank you! I will try it out. This works (it triggers when the nested array, selectedItemsState, changes)
I get, as expected this object, with a new state for the nested property, selectedItemsState.
But the below doesn't work, when the nested array, selectedItemsState, changes...
And I'm not sure why... I want to try and get selectedItemsState, when this map changes,
|
Beta Was this translation helpful? Give feedback.
-
I gave up, and ultimately resorted to doing this, instead of trying to create a dynamic map (since right now deep signals are not supported)
|
Beta Was this translation helpful? Give feedback.
-
Could you please create a StackBlitz for it? Then we have something where we can collaborate and don't have to share code snippets. |
Beta Was this translation helpful? Give feedback.
-
Somebody has already done a great job of answering why store.Map()[key] wasn't triggering in a compute, when a nested item (like a nested array) changed. But, after giving up, the next day (this morning) I then ungave up, and found this documentation: https://ngrx.io/guide/signals/signal-store/entity-management It worked great, when you have data in Maps. (somehow the library takes care of any deep signalling changes) |
Beta Was this translation helpful? Give feedback.
-
Thanks. The more finegrained way works (tbh I cannot tell the performance difference, but I suppose any extra efficiency counts!) I DID NOTICE that if I changed the type from
State Type Definitions
Initial State
NGRX Signal Store
|
Beta Was this translation helpful? Give feedback.
Somebody has already done a great job of answering why
store.Map()[key] wasn't triggering in a compute, when a nested item (like a nested array) changed.
(My manual way, I'm still not sure why it didn't work)
But, after giving up, the next day (this morning) I then ungave up, and found this documentation: https://ngrx.io/guide/signals/signal-store/entity-management
It worked great, when you have data in Maps. (somehow the library takes care of any deep signalling changes)