PDA

View Full Version : 4.1 -> 4.2 Application launch no longer being called



Tomas Pospisek
18 Apr 2013, 7:28 AM
I've upgraded my app from 4.1.1a to 4.2.0. Now my application won't start any more. More precisely the "launch()" methode won't ever be called any more.

My application is being defined like this:



Ext.application({
name: 'MyApp',
appFolder: '/assets/app',

controllers: ['Users'],

stores: ['Users'],

launch: function() {

Ext.create('Ext.container.Viewport', {
layout: 'fit',
minWidth: 850,
items: [
{
xtype: 'usereditor',
title: 'Users',
id: 'userEditor',
},
],
});

this.getController('Users').go();
}
});


I can see that ExtJS is registering an "onReady" callback that would execute "new App()" however that onReady handler never gets called, no new instance of the application is made and thus launch is not being called.

There are no errors in the console and ExtJS is able to fetch all resources that it needs.

Why would the application never be instantiated? Is there a way to force it?

I have noticed that loading dependencies ("requires") seems to have changed from depth first to width first or something. Does the Loader require some special sauce with 4.2 that it didn't before?

Thanks a lot for any hints,
*t

slemmon
19 Apr 2013, 10:26 PM
Off-hand, I have no idea. Certainly seems to be in order there.
It should be about this straight:
http://jsfiddle.net/slemmon/kuhHz/

If you set a breakpoint is it hitting the Ext.application()?

Tomas Pospisek
22 Apr 2013, 3:45 AM
So I've succeeded to reduce the problem to the exact failing code. I've however not succeeded in finding out why ExtJS 4.1.1a would not fail (in contrast to 4.2).

If I take slemmon's example http://jsfiddle.net/slemmon/kuhHz/ (http://jsfiddle.net/slemmon/kuhHz/%20)and add a require like this:



Ext.application({
name: 'MyApp',
requires: [ 'MyApp.foobar' ],
init: function () {
console.log('app init');
},
launch: function () {
console.log('app launch');
}
});


and add an empty file "app/foobar.js" then the application will be executed, without any trace of error and without any output either. It will just silently fail. That's an ExtJS bug in my opinion.

If you add to "app/foobar.js":



Ext.define('MyApp.foobar', {});


then the app will start as expected.

Coming back to what I wrote in the beginning: in my original app I did require a 'Users' model which in turn:



requires: ['MyApp.types.int0']


and there was a file "app/types/int0.js" which contained this:



Ext.data.Types.INT0 = {
type: 'int0',
// et cetera
};


As one can see, no "MyApp.types.int0" class would get defined there. For some reason, this would "work" in Ext 4.1.1a despite not defining the expected class "MyApp.types.int0". ExtJS would somehow recover and execute my application. In ExtJS 4.2 on the other hand everything silently fails without any trace.

The reason to structure my files "weirdly" like that was that as a newbie I did not know which would be the canonical place to extend the ExtJS Field type system (I still don't know). I assumed naively that a 'require' would simply include a file, and that would be it.

To wrap up: to me silently failing without any trace whatsoever is a ExtJS bug and would need to be fixed: if ExtJS needs something vitally in order to do what it needs to do then it absolutely must say to the developper via an error message. Failing silently is not an workable option.

Tomas Pospisek
22 Apr 2013, 6:52 AM
Off-hand, I have no idea. Certainly seems to be in order there.
It should be about this straight:
http://jsfiddle.net/slemmon/kuhHz/

If you set a breakpoint is it hitting the Ext.application()?

yes it was hitting Ext.application()

(but see my other comment)

Tomas Pospisek
23 Apr 2013, 8:47 AM
See http://www.sencha.com/forum/showthread.php?262072-quot-requires-quot-silently-fails&p=960303#post960303