Results 1 to 3 of 3

Thread: Removing an object from localstorage does not remove it from cache

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-4962 in Touch 2.3.1 (38).
  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    160
    Vote Rating
    3
      0  

    Default Removing an object from localstorage does not remove it from cache

    ST 2.2.1

    Code is in WebStorage.js. The this.cache reference to the object is not removed.

    Code:
    removeRecord: function(id, updateIds) {
            var me = this,
                ids;
    
    
            if (id.isModel) {
                id = id.getId();
            }
    
    
            if (updateIds !== false) {
                ids = me.getIds();
                Ext.Array.remove(ids, id);
                me.setIds(ids);
            }
    
    
            me.getStorageObject().removeItem(me.getRecordKey(id));
        },
    fix is simple, add in the following lines to the removeRecord function.


    Code:
         this.cache[id] = null;
         this.cache[id] = undefined;  // (as readRecord checks to see if it's === undefined)
    WebStorage.clear should also probably nuke the cache as well.


    Note that really, since I've set useCache to false for the model, it should pass this set up to the proxy object and bypass the cache entirely, but that's a bit more work.

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    4,094
    Vote Rating
    136
      0  

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    11
      0  

    Default

    This has been fixed for the next release. Thanks for the report and suggested fix!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •