-
20 Nov 2011 3:48 PM #1
LocalStorage Proxy adds IDs on every Update
LocalStorage Proxy adds IDs on every Update
REQUIRED INFORMATION
Ext version tested:- Sencha Touch 2 rev PR2
- Safari
- Mobile Safari
- Android Browser
- Chrome
- HTML5 Doctype
- If you update an item in a localstorage proxy, a new ID is added to the IDs set when it is not supposed to.
- This seems to happen because the code to add an ID is checking to see if the ID exists before adding it. But, the IDs in the localstorage returned by the 'getIds' function are STRINGS, whereas the ids normally provided to a local storage a INTs.
- Create a storage with a localstorage proxy.
- Set a model on a store that has an ID with the type "int".
- Update an item in the local store and watch the ID you just added get duplicated.
- The update should not have created a new ID. It should have found the existing one.
- A new ID is added to the local store.
It seems to only happen if your ID in the Model is a type="int".
Possible fix:- On Line 32174 of sencha-touch-all-debug-w-comments.js in PR2 change the IF statement to the following:
I am just making sure that the ID provided is a string like it will be in the array of IDS provided by 'getIds()'Code:if (id !== undefined && Ext.Array.indexOf(ids, String(id)) == -1) {Twitter: lylepratt
-
21 Nov 2011 9:27 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,651
- Vote Rating
- 14
Thank you for the report, we are in the middle of cleaning up a lot of data issues. I'll make sure this is part of that as well.
-
7 Jan 2012 11:52 AM #3
Just wanted to bump this, since this bug is still present in PR 3, thanks

-
9 Jan 2012 9:18 AM #4Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,651
- Vote Rating
- 14
The bump really does nothing, it's tracked in a separate system. We are aware that localstore has been broken during the preview and we're working through the entire data package.
-
9 Jan 2012 9:19 AM #5
Great to hear Jamie. You guys are doing an awesome job!
Twitter: lylepratt
-
16 Jan 2012 2:27 PM #6Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Haarlem, Netherlands
- Posts
- 1,235
- Vote Rating
- 4
This has been fixed as part of the next Touch 2.0 release. Thanks for the report.
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-1068
in
2.0.


Reply With Quote
