casaval / meteor-reactive-dict

mirror of reactive-dict package from meteor (https://github.com/meteor/meteor)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using set with an object loses prototype information

VitorHP opened this issue · comments

Hi,

if you use #set with an object that has non-default stuff in its prototype (like collection with helpers or custom objects, for example), that information is not saved, because the object is serialized upon being stored.

I think a solution for this would be to only serialize objects for comparison with existing data, but store them as they come, and since read operations are probably way more common that write, I don't think it would cause a performance issue. Maybe it would even improve performance since we won't need to #parse the objects anymore on #get.

If you guys think this is a good idea, I could do a PR.