Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-7281 in 4.1.3.
  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Eindhoven
    Posts
    115
    Vote Rating
    2
    damien is on a distinguished road

      0  

    Default [4.1.2] Ext.app.Application overwrites MyApp.app namespace

    [4.1.2] Ext.app.Application overwrites MyApp.app namespace


    REQUIRED INFORMATION


    Ext version tested:
    • Ext 4.1.2
    Browser versions tested against:
    • not relevant
    Description:
    • ExtJs 4.1.2 introduced the new 'feature' where Ext.app.Application assigns itself to 'MyApp.app' (with MyApp being the application namespace as defined by the appName property)
    • This didn't consider that users might actually use this path as namespace for class definitions, e.g. 'MyApp.app.MyClass'
    Steps to reproduce the problem:
    • Create a class in your application's namespace in a package named 'app', like so: Ext.define('MyApp.app.SomeClass')
    The result that was expected:
    • The class being available and accessible via the defined namespace
    The result that occurs instead:
    • The class not being available and accessible via the defined namespace
    Test Case:

    Code:
    Ext.define('MyApp.app.SomeClass', { singleton: true, property: 'prop' /*...*/});
    Ext.application({
       uses: ['MyApp.app.SomeClass'],
       appName: 'MyApp',
       launch: function() {
          console.log(MyApp.app.SomeClass.property === 'prop');  // FAILS: SomeClass is undefined
       }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So what would you like us to do? Have a config for where to cache the Ext.application instance?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Eindhoven
    Posts
    115
    Vote Rating
    2
    damien is on a distinguished road

      0  

    Default


    Well,
    a config or
    template method or
    a function Ext.app.Application#getApp() or
    disable the feature by default or
    ...

    I guess that is a decision that a Sencha developer should make.

  4. #4
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Eindhoven
    Posts
    115
    Vote Rating
    2
    damien is on a distinguished road

      0  

    Default


    This 'feature' was introduced in 4.1.2. Maybe not the best time to do so in a maintenance release.

    Also, I recommend finding a prominent place to document the fact that it is not possible to use namespaces/class names with 'appname.app'.

    It is not really obvious what is happening when it happens.


    EDIT:
    Maybe a good way around the documentation problem is to throw an exception when assigning the application object to a property that is not empty - and include a reference to how to reconfigure the application.

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by damien View Post
    Well,
    a config or
    template method or
    a function Ext.app.Application#getApp() or
    disable the feature by default or
    ...

    I guess that is a decision that a Sencha developer should make.
    The only reason I ask is when people wanted this, they all were wanting it to be on the app property.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,000
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    @OP Agreed.

    I've pushed up a fix so it will now be configurable by an appProperty config. Also, it will throw a warning if the default is left in place and it's overwriting something.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  7. #7
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Eindhoven
    Posts
    115
    Vote Rating
    2
    damien is on a distinguished road

      0  

    Default


    @evan
    thx.

    @mitchell
    thx for asking
    I am happy with the chosen approach.

Thread Participants: 2