PDA

View Full Version : [FIXED] localstorage proxy sync error, Batch.js related ?



sdiprizio
13 Oct 2011, 1:24 AM
Hi,

I tried to use a localstorage proxy in my project but when I try to sync I have an error :
TypeError: 'undefined' is not an object (evaluating 'me.proxy[operation.action]')

I've seen in the Tweeter example that localstorage seems to be non functional but I explored this error.

This error is sent in Batch.js line 178 :


me.proxy[operation.action](operation, onProxyReturn, me);

proxy is indeed undefined.

I explored a bit the Ext.data.Batch class and it seems that the constructor doesn't retain the proxy config object. It calls me.mixins.observable.constructor.call(me, config) to retain the listener but nothing about proxy.

I modified a bit the constructor to retain the proxy and it now seems to work (not completely tested).


constructor: function(config) {
var me = this;


/**
* @event complete
* Fired when all operations of this batch have been completed
* @param {Ext.data.Batch} batch The batch object
* @param {Object} operation The last operation that was executed
*/


/**
* @event exception
* Fired when a operation encountered an exception
* @param {Ext.data.Batch} batch The batch object
* @param {Object} operation The operation that encountered the exception
*/


/**
* @event operationcomplete
* Fired when each operation of the batch completes
* @param {Ext.data.Batch} batch The batch object
* @param {Object} operation The operation that just completed
*/


me.mixins.observable.constructor.call(me, config);


// HACK start sdiprizio (brute force, probably a better/cleaner way to do that)
if (config.proxy)
this.proxy = config.proxy;
// HACK end


/**
* Ordered array of operations that will be executed by this batch
* @property {Ext.data.Operation[]} operations
*/
me.operations = [];
},


Please take in consideration that I am new to Sencha, and it is possible that I do not use the API correctly and that there is actually no bug.
I'm also sorry about my poor english.

Regards.
Stephane.

Jamie Avins
13 Oct 2011, 7:31 AM
There do seem to be some issues with LocalStorage at the moment. Thank you for the report.

yoh.suzuki
21 Oct 2011, 10:23 AM
Thank you for sharing, Stephane! I ran into the same problem and I'm using your workaround for now. - y

edspencer
3 Nov 2011, 11:49 AM
This is because of some changes to Observable that require updates to Batch and a few other classes. We're working through a number of data package updates at the moment, though these will probably not make it into the next public build.

mysterydiner
8 Nov 2011, 5:32 AM
Hi,

I tried to use a localstorage proxy in my project but when I try to sync I have an error :
TypeError: 'undefined' is not an object (evaluating 'me.proxy[operation.action]')

I've seen in the Tweeter example that localstorage seems to be non functional but I explored this error.

This error is sent in Batch.js line 178 :


me.proxy[operation.action](operation, onProxyReturn, me);

proxy is indeed undefined.

I explored a bit the Ext.data.Batch class and it seems that the constructor doesn't retain the proxy config object. It calls me.mixins.observable.constructor.call(me, config) to retain the listener but nothing about proxy.

I modified a bit the constructor to retain the proxy and it now seems to work (not completely tested).


constructor: function(config) {
var me = this;


/**
* @event complete
* Fired when all operations of this batch have been completed
* @param {Ext.data.Batch} batch The batch object
* @param {Object} operation The last operation that was executed
*/


/**
* @event exception
* Fired when a operation encountered an exception
* @param {Ext.data.Batch} batch The batch object
* @param {Object} operation The operation that encountered the exception
*/


/**
* @event operationcomplete
* Fired when each operation of the batch completes
* @param {Ext.data.Batch} batch The batch object
* @param {Object} operation The operation that just completed
*/


me.mixins.observable.constructor.call(me, config);


// HACK start sdiprizio (brute force, probably a better/cleaner way to do that)
if (config.proxy)
this.proxy = config.proxy;
// HACK end


/**
* Ordered array of operations that will be executed by this batch
* @property {Ext.data.Operation[]} operations
*/
me.operations = [];
},


Please take in consideration that I am new to Sencha, and it is possible that I do not use the API correctly and that there is actually no bug.
I'm also sorry about my poor english.

Regards.
Stephane.

I've been struggling with this for days and thought it was something I was doing wrong with the new MVC architecture. Well done Stephanie - works for me - thanks x a million. And your English is great too!

TommyMaintz
16 Jan 2012, 9:23 AM
This has been fixed as part of the next Touch 2.0 release. Thanks for the report!