google / lovefield

Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.
https://google.github.io/lovefield/
Apache License 2.0
6.81k stars 366 forks source link

Field names in "splice" change objects in observable queries #115

Closed mgd134 closed 8 years ago

mgd134 commented 8 years ago

Hi. I'm using lovefield in a project that uses the Aurelia framework. We use jspm for package management. We make extensive use of observable queries to update our UI. After a recent jspm update I noticed that the fields in splice-type changes changed names. As per the lovefield docs, I had been expecting the changes to be delivered in the same manner as Array.observe, and they were until this recent jspm update. The fields removed and addedCount now seem to be reported as Rg and Pg respectively.

So to my questions: Is this an issue with lovefield? Could an update to another library be causing this issue? Or should I just use the new field names and it currently works as expected?

Thanks.

freshp86 commented 8 years ago

This sounds like a bug, probably introduced by the latest version 2.1.2. The names should not have been changed. Will investigate. In the meantime can you stick with previous version to workaround this issue.

mgd134 commented 8 years ago

Just was talking with a colleague and he had a good question: with the weird field names could this possibly have something to do with minification?

freshp86 commented 8 years ago

Absolutely. Specifically the bug is at those lines, https://github.com/google/lovefield/blob/master/lib/diff_calculator.js#L170-L174. Putting quotes around the keys of that object fixes the problem. Working on adding some tests though along with the fix.

mgd134 commented 8 years ago

Thanks!