Reputation: 562
On the page: doc
This section:
states that
dispatch(reactionAdded())
won't cause the component to re-render as posts
is not changed here. But it seems reactionAdded
does mutate one of the posts
cause the entire posts
array to be replaced by a new one.
Another question:
Does it mean value returned by
selectById
selectIds
from createEntityAdapter
will always return the same array(unchanged reference) as long as all id
s of entity are unchanged even if content of entities
memeber is changed?
Upvotes: 1
Views: 364
Reputation: 67459
Hmm. I wrote that tutorial, and it's entirely possible I made a mental mistake when writing that example. Yeah, reactionAdded
does update a post entry, which would also mean that there should be a new posts
array generated as a result because of the immutable updates. Probably need to come up with a different example there :)
And yes, selectById
always does a straight lookup - ie, return state.posts.entities[postId]
, so there's no derived data involved. It just returns that one item by itself.
Upvotes: 1