Duplicate records in localStorage after update to 0.16

27 views
Skip to first unread message

Zachary Dixon

unread,
Jun 12, 2014, 5:56:17 PM6/12/14
to batm...@googlegroups.com
I believe this happened after I updated the batman-rails gem to 0.16 but for some reason all of my "seed" data is being duplicated after it is created. In the debugger where the records are created, it has the correct amount in localStorage, but when I exit the debugger, everything is duplicated with the same values (even 'id').

Thanks,
Zach

Robert Mosolgo

unread,
Jun 12, 2014, 6:19:17 PM6/12/14
to batm...@googlegroups.com
=O The only thing that comes to mind is, I think in 0.15 there were some cases where IDs were automatically coerced to integers, and they were removed. So, it's possible identity lookups are failing because it's searching with a integer, but IDs from storage are coming back as strings. Kind of a shot in the dark, though.

If you want to hop in #batmanjs on freenode I could help you troubleshoot.


--
You received this message because you are subscribed to the Google Groups "batman.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to batmanjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zachary Dixon

unread,
Jun 13, 2014, 2:28:50 PM6/13/14
to batm...@googlegroups.com, rdmo...@gmail.com
Ah, that was it. So anytime I was trying to load a record based on another record's id, such as the user's id, it was passing it in as a String which the id in the storage was an int. So after calling parseInt every time I do that, all seems fine.

i.e.

App.Model.load {user_id:App.get('currentUser.id')},(err,result)=>...

Turned into

App.Model.load {user_id:parseInt(App.get('currentUser.id'))},(err,result)=>...

Robert Mosolgo

unread,
Jun 30, 2014, 10:35:37 PM6/30/14
to batm...@googlegroups.com, rdmo...@gmail.com
Glad to hear it. Looking to clean this up in the next go-round: https://github.com/batmanjs/batman/pull/1071
Reply all
Reply to author
Forward
0 new messages