View Full Version : [CLOSED] Bug on dynamic loading of js modules

29 Apr 2013, 1:11 AM
Hi to all.

I encountered this bug that plagues the dynamic loading of modules javascript.
I have attached an application that allows you to replicate the bug. The execution of this test case, however, requires a web server to remedy the problem of "cross requests".

The application is conceptually very simple: it is a panel with two buttons. The first button will instantiate the view "Alfa.Beta" (a simple panel), while the second button will instantiate the view "Alfa.Beta.Gamma" (still a simple panel).

Once the application is launched, if as first thing you press the button 1 and then the button 2, everything will be error-free, and the two views will be displayed without any problems.

Now replicate the error: close the application and restart it again. This time we press the button 2 first and then the button 1. When you press button 1 will get the following error:


In my opinion the problem lies within the nesting structure of views, namely:


If it is loaded first the longer one, then the loading of the shorter will cause the error.

I am at your disposal for any clarification.



29 Apr 2013, 4:01 AM
This isn't a bug, you're overwriting the class.

JS doesn't have any concept of namespaces, so when we talk about creating a namespace with a class, in simple terms, we mean:

Ext.define('A.B.C', {});

A = {};
A.B = {};
A.B.C = {};

So essentially, you can't have a class that already exists as a "namespace". For example, we can't have an Ext.panel class, because Ext.panel.Panel already exists as a class.

29 Apr 2013, 4:41 AM
Thank you very much Evan for your usefully reply.