Results 1 to 4 of 4

Thread: callSuper works in develoment but not in production

    Success! Looks like we've fixed this one. According to our records the fix was applied for SDKTOOLS-946 in 5.0.3.
  1. #1
    Sencha Premium Member
    Join Date
    Jul 2014
    Posts
    9

    Default callSuper works in develoment but not in production

    Ext version tested:
    • Ext 5.0.0
    • Ext 5.0.1
    • Ext 5.0.2.1432
    Sencha Cmd version tested:
    • Sencha Cmd 5.0.2.270

    Steps to reproduce the problem:

    Create a default application.
    • In document root mkdir ext5

    • cd ext5

    • sencha -sdk /path/to/ext generate app Test my/test

    • In my/test/app/view create files Good.js
      Code:
       Ext.define('Test.view.Good', {
           method: function () {
               console.log('Good');
           }
      
      
       });
      and Bad.js
      Code:
       Ext.define('Test.view.Bad', {
          extend : 'Test.view.Good',
           method: function () {
               console.log('Bad');
      
      
               // ... logic but with a bug ...
      
      
               this.callParent();
           }
      
      
       });

    • In my/test/overrides create folder view and in it file Bad.js
      Code:
       Ext.define('Test.overrides.view.Bad', {
           override: 'Test.view.Bad',
      
      
           method: function () {
               console.log('Fixed');
      
      
               // ... logic but with bug fixed ...
      
      
               this.callSuper();
           }
      
      
       });
    • In my/test/app/view/main/MainController.js modify onClickButton
      Code:
      onClickButton: function () {        
              Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
              var my = Ext.create('Test.view.Bad');
              my.method();
          },

    • sencha app watch
    • sencha app build production

    The result that was expected:
    Browser pointed to localhost/ext5/my/test/index.html. Click Button. In console
    • Fixed
    • Good
    Browser pointed to localhost/ext5/my/test/build/production/Test/index.html. Click Button. In console
    • Fixed
    • Good
    The result that occurs instead:
    Browser pointed to localhost/ext5/my/test/index.html. Click Button. In console
    • Fixed
    • Good
    Browser pointed to localhost/ext5/my/test/build/production/Test/index.html. Click Button. In console
    • Fixed
    • Bad
    • Good

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165

    Default

    Thanks for the bug report. It looks like this is fixed for the upcoming Cmd 5.0.3

  3. #3
    Sencha Premium User westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    1,035

    Default

    This is concerning, since use callSuper in a few Ext overrides ourselves.

    Does it always call the immediate base class rather than the original one, or does it need a specific set of conditions to apply?
    Any workaround for it?

    Cheers,
    Westy
    Product Architect
    Altus Ltd.

  4. #4
    Sencha User dongryphon's Avatar
    Join Date
    Jul 2009
    Location
    Kansas
    Posts
    1,748

    Default

    You should be able to disable that optimization locally like so:
    Code:
        foo: function() {
            // @noOptimize.callParent
            this.callSuper();
    
            //...
        },
    The //@noOptimize.callParent directive above disables that piece of the optimizer for just that next line.

    To disable entirely, you can add the following to app.json:

    Code:
        "output": {
            //...
    
            "js": {
                "optimize": {
                    "callParent": false
                }
            }
        }
    Even though "callParent" is the name of the optimization, it optimizes both callParent and callSuper calls.
    Don Griffin

    "Use the source, Luke!"

Posting Permissions

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