Sorry, I tried searching but could not find the answer to this and feel like it either should be part of the documentation (if ReactMeteorData supports reference equality) or should be considered for implementation (if it does not).
Let's say in getMeteorData you returns the results of a collection like say:
Now let's say it returns 3 posts. Somebody (from a different session) updates the 3rd post.
My question is, can we reliably do reference equality (===) to determine that the first 2 posts are equal and the 3rd post is not equal in shouldComponentUpdate. This comparison would obviously be incredibly quick.
Further, if accounts is updated, can we do reference equality on posts to determine that the entire posts array has or hasn't changed.
It feels like this should be entirely possible given that Meteor ships only the changes from the server to the client. If no change is shipped on posts then use the same array. If there is a change in posts, then clone the Array and swap out the changed item with the new item.
It's unclear to me from an admittedly cursory look at the source code whether this is supported.
Sorry, I tried searching but could not find the answer to this and feel like it either should be part of the documentation (if ReactMeteorData supports reference equality) or should be considered for implementation (if it does not).
Let's say in getMeteorData you returns the results of a collection like say:
Now let's say it returns 3 posts. Somebody (from a different session) updates the 3rd post.
My question is, can we reliably do reference equality (===) to determine that the first 2 posts are equal and the 3rd post is not equal in shouldComponentUpdate. This comparison would obviously be incredibly quick.
Further, if
accounts
is updated, can we do reference equality onposts
to determine that the entireposts
array has or hasn't changed.It feels like this should be entirely possible given that Meteor ships only the changes from the server to the client. If no change is shipped on
posts
then use the same array. If there is a change inposts
, then clone the Array and swap out the changed item with the new item.It's unclear to me from an admittedly cursory look at the source code whether this is supported.