Results 1 to 7 of 7

Thread: [FIXED] [2.x] Destroying a Store doesn't destroy its underlying proxy

  1. #1
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default [FIXED] [2.x] Destroying a Store doesn't destroy its underlying proxy

    destroying a Store does not destroy its underlying DataProxy.

    the following code resolves this
    Code:
    Ext.override(Ext.data.store, {
        destroy : function() {
            if (this.storeId || this.id) {
                Ext.StoreMgr.unregister(this);
            }
    
            if (this.proxy) {
                Ext.destroy(this.proxy);
            }
    
            this.data = null;
            this.purgeListeners();
        }
    });

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    128
      0  

    Default

    Shouldn't a store also destroy its reader?

  3. #3
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default

    yes it should. i was only concentrating on the Store though

    [edit]
    on 2nd thought, how would it do that?

  4. #4
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,010
    Vote Rating
    940
      0  

    Default

    Just FYI, the proxy and the reader don't have destroy methods, but they probably should, at the very least to purge the listeners.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default

    Quote Originally Posted by evant View Post
    Just FYI, the proxy and the reader don't have destroy methods, but they probably should, at the very least to purge the listeners.
    whoops... my bad... forgot to include my custom override (for the proxy):
    Code:
    Ext.override(Ext.data.DataProxy, {
        destroy: function() {
            this.purgeListeners();
        }
    });
    Ext.override(Ext.data.HttpProxy, {
        destroy: function() {
            // abort current request, if any
            if (this.activeRequest) {
                Ext.Ajax.abort(this.activeRequest);
            }
    
            Ext.data.HttpProxy.superclass.destroy.call(this);
        }
    });

  6. #6
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default

    [friendly bump ]
    affects 3.x too -- not sure how this weighs in with the new Ext.Direct stuff though.

    p.s. @condor, re: Reader destruction, how would we do that?

  7. #7
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,010
    Vote Rating
    940
      0  

    Default

    Committed both branches.

    RE: direct, we need some good way of cancelling transactions, though I don't know there's a good way to handle that when we're considering request batching...

    I'll mark this one as fixed now.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Posting Permissions

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