For a resource, update its underlying data only if the API data is different than its current data.#37
For a resource, update its underlying data only if the API data is different than its current data.#37yadavsaroj wants to merge 1 commit intostaugaard:masterfrom
Conversation
…fferent than its current data.
There was a problem hiding this comment.
You could use Em.compare to compare the two arrays (guarded by an isArray). There's also isEqual, which doesn't seem to work for arrays afaict.
There was a problem hiding this comment.
I am not comparing the actual contents of an array, all I am checking is if they both are empty. Em.compare though can be used, seems to be an overkill for that.
btw just checked if Em.compare looks into actual array contents, unless I am missing something does not look like that as
Em.compare([{k1:1}], [{k1:111}]) returns 0, the value it returns if both objects being compared are equal.
There was a problem hiding this comment.
Ah, yeah compare can't be used here. So this is meant to support just empty arrays and scalars? (i.e it will skip arrays with values and objects)
There was a problem hiding this comment.
yes! It won't compare non empty arrays.
No description provided.