Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Ext JS Premium Member
    Join Date
    May 2011
    Location
    Northern California
    Posts
    228
    Vote Rating
    15
    BillHubbard has a spectacular aura about BillHubbard has a spectacular aura about BillHubbard has a spectacular aura about

      0  

    Default Launch and onReady fire out of order

    Launch and onReady fire out of order


    I have a simple MVC app, which I define in an "Sjs.apps" path that I define via Ext.Loader.setPath:

    Code:
    Ext.define('Sjs.apps.examples.windowdebug.Main', {
        extend: 'Ext.app.Application',
        alias: 'app.exampleswindowdebug',
    
        requires: [ 'Sjs.apps.examples.windowdebug.view.WindowDebugView' ],
        
        controllers: [ ],
        
        constructor: function() {
            var me = this;
            me.win = Ext.create('widget.windowdebugview');
            me.callParent(arguments);
            me.close = function() {
                   me.win.close();
            };
        },
    
        launch: function() {
            this.win.show();
        }
    
    });
    It has one view that I define as a Window:
    Code:
    Ext.define('Sjs.apps.examples.windowdebug.view.WindowDebugView',{
        extend: 'Ext.window.Window',
        alias: 'widget.windowdebugview',
        requires: [ 'Ext.layout.container.Border' ],
        width: 400,
        height: 300,
        defaultType: 'panel',
        layout: 'fit',
    
        initComponent: function(){
            var
                me = this
            ;
            
            Ext.apply(me,{
                title: 'Example Windowed Application',
                closable: true,
                closeAction: 'destroy',
                draggable: true,
                renderTo: Ext.getBody()
                //html: '<div><span>Example Application goes here</span></div>'
            });
    
            me.callParent();
        }
    });
    My launch code looks like this:
    Code:
    (function() {
        var
            appName = 'Sjs.apps.examples.windowdebug.Main',
            appAlias = 'app.exampleswindowdebug'
        ;
        // Load core dependencies
        Ext.require([
               'Ext.LoadMask',
               'Ext.app.Application'
           ]);
        Ext.require(appName, function() {
            Ext.onReady(function() {
                var 
                    app1 = Ext.create(appAlias),
                    app2 = Ext.create(appAlias)
                ;
                // Windows should display here as a result of launch getting called via Ext.create
                // Set a breakpoint here to see them in 4.0.5 or 4.0.7. They will not be open in
                // 4.1.0 or 4.1.1 and the subsequent close() calls will fail because launch does not
                // execute until after this onReady handler exits.
                app1.close();
                app2.close();
            });
        });
    })();
    In 4.0.5 and 4.0.7, this works, since the launch method of the app gets called during create before the onReady handler exits, above, as I would expect (I would expect launch to get called to open the window before I later close it within the same handler). But in 4.1.0 and 4.1.1, launch gets called after the onReady handler exits, so app1.close() fails (with an unhandled exception) because the window has not been rendered yet.

    You might wonder why a window would be opened and closed within the same handler. Think: unit tests. I have a unit test that launches my app in onReady, performs some tests, then closes the window. It was this unit test that broke when updating from 4.0.7 to 4.1.0.
    Last edited by BillHubbard; 6 Feb 2013 at 11:08 AM. Reason: Correction for clarity

  2. #2
    Ext JS Premium Member
    Join Date
    May 2011
    Location
    Northern California
    Posts
    228
    Vote Rating
    15
    BillHubbard has a spectacular aura about BillHubbard has a spectacular aura about BillHubbard has a spectacular aura about

      0  

    Default Fixed

    Fixed


    UPDATE: This was a problem in 4.1.0 and 4.1.1 but appears to be fixed in 4.1.3.