PDA

View Full Version : [FIXED] [4.2.1] options are ignored when calling reload() before calling load() on a store



joekrill
2 Jan 2014, 6:42 AM
Ext version tested:


Ext 4.2.1.883
Browser versions tested against:

Chrome Version 29.0.1547.76 m
FF 25.0.1 (firebug 1.12.5 installed)
IE 10.0.10
DOCTYPE tested against:

html
Description:

Calling `reload` on a store and passing in an `options` parameter before ever calling `load` on that store will cause the store to load, but `options` will be ignored.
Steps to reproduce the problem:

Create a store
Load it calling: store.reload(options) and passing in options (`callback`, for example)
Fiddle: https://fiddle.sencha.com/#fiddle/2ej
The result that was expected:

Options should be applied (and in the example above, callback should have been invoked)
The result that occurs instead:

Options are not applied (and in the example above, callback is never invoked)
Comments:

I suppose you could argue that you shouldn't be calling reload() before calling load() anyway, but you may not know if the store has been loaded before. Also, calling reload() does, in fact, load the store, so if reload() shouldn't be called without first calling load(), then reload() probably shouldn't do anything. Additionally, calling reload() a second time will work as expected, since reload() simply calls load() after applying `lastOptions` to the options parameter.

It's a very simple fix by changing the reload method to the following in /src/data/AbstractStore.js (changes/additions in green):



reload: function(options) {

return this.load(this.lastOptions || {}, options));

},


Or, alternatively, simply initialize lastOptions to `{}` in /src/data/AbstractStore.js

joekrill
7 Jan 2014, 8:58 AM
Err, hello? This seems to have been ignored... did I submit this incorrectly?

evant
7 Jan 2014, 12:25 PM
Thanks for the test case. This is a dupe of: http://www.sencha.com/forum/showthread.php?265693. It's fixed in 4.2.2.

joekrill
8 Jan 2014, 6:39 AM
Oh, excellent Thanks! I have no idea how i missed that -- I searched for an existing report and came up empty.