derbyjs / racer

Realtime model synchronization engine for Node.js
1.19k stars 117 forks source link

When creating implied operation detect case where we need to replace … #232

Closed ishbu closed 9 years ago

ishbu commented 9 years ago

…null values in an array

This fixes a bug where when creating an implied operation on an array with null values, a ListInsert operation was erroneously created.

i.e. for the following value [null, null, {value:3}] attempting to set an object at the 0th index of the array would result in the object instead being pushed to the end of the array

ishbu commented 9 years ago

Credit to @distracteddev for the bug discovery and help on implementation

distracteddev commented 9 years ago

LGTM

distracteddev commented 9 years ago

"i.e. for the following value [null, null, {value:3}] attempting to set an object at the 0th index of the array would result in the object instead being pushed to the end of the array"

I think you meant to say "pushed to the beginning of the array"

ishbu commented 9 years ago

Yep thats correct, the erroneous behavior would be that the object would be pushed to the beginning of the array, instead of replacing the null value at the 0th index

bruchu commented 9 years ago

LGTM, but i think we should have a unit test that goes along with this