Can the store have non serialized or serialized objects? #104
-
Can the store have non serialized or serialized objects? I noticed that prior to the store.update() method if object or list is an instance of the class it not become a serialized object, in the time of selecting object or list from the store it is still an instance of a class. I like that behavior, is that normal? how does it need to work? If I'm not wrong for example in ngrx objects in the store are serialized. I like the idea to have available methods from the class instance but, I'm confused if that is the same reference, isn't the object once when is changed somewhere in any component will be modified also in the store without changed without store updateEntities. (if that is the same reference in the memory) Maybe I missing something. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
AFAIK one of the basic store ideas is about store data immutability. Thus, whatever you select from the store should be a just a copy (unless you use immer.js). |
Beta Was this translation helpful? Give feedback.
-
Elf and ngrx both store plain immutable objects. You can convert it to a class in the query selector. |
Beta Was this translation helpful? Give feedback.
Elf and ngrx both store plain immutable objects. You can convert it to a class in the query selector.