View Full Version : [CLOSED] SA 2.1 - Why overridden class "requires" the overriding class?

22 Aug 2012, 2:22 AM

Architect Build tested:

Build: 588

Project Type:

ExtJS 4.1.x


I have a huge project that I was working on with the SA 2. Some of the components in my project were overridden. Now that I've upgraded to SA 2.1, the components which are overridden can not be opened. I investigated the code a lot and found that such components are requiring their own overriding classes. It's worth mentioning that this problem is not reproducible in a project that is created in SA 2.1 from start. That's why I have attached a sample project to demonstrate the bug.

Steps to reproduce the problem:

** Please keep in mind that this scenario is applicable in projects which are upgraded from SA 2. Such a project is attached.
In Sencha Architect 2.1, drag and drop a window to the views folder.
Create an override for the window.
The created override is empty, try to add something to it.
Go back to "Generated Class" code and you shall see the troublesome "requires" statement.

The result that was expected:

The overridden class needs not to require the overriding class.

The result that occurs instead:

There's an automatically generated "requires" statement in the overridden class which prevents the code to be executed. It's impossible to remove this "requires" statement and have the class overridden.


Screenshot, Project, or Video:

Sample upgraded project from SA 2: 38181

Possible fix:

not provided

Operating System:

Ubuntu 12.04

22 Aug 2012, 8:07 AM
I'm on the case here. Trying to fully understand what's going on here so bare with me.

First you should know that it's a known issue that overrides don't upgrade well and that's because once you've generated the initial override we don't touch it ever again. Have you tried removing the override and copying the correct code back into it?

The new requires from the overridden class is a known pattern used in the framework itself that allows for partial classes.

22 Aug 2012, 10:43 PM
Hi Phil

I'm so glad that you are on the case since this bug blocked me completely. I've already tried to remove and recreate an override but it's no use and I'm going to explain how, in detail, in this post.

In the sample project I supplied above, try to drop a window in views folder and create an override class for it. Since the project is corrupted, the initial override script looks like this (which is incomplete of course):

Ext.define('OverrideBug.view.override.MyWindow1', {
override: 'OverrideBug.view.MyWindow1'


At this point there's no sign of the "requires" statement in the original class. Now try to complete the override script like this:

Ext.define('OverrideBug.view.override.MyWindow1', {
override: 'OverrideBug.view.MyWindow1'

}, function() {

Once this part is added, the "requires" statement appears magically in the "Generated Class" script. There's something strange about this behavior. You mentioned that "once you've generated the initial override we don't touch it ever again", but it seems to me that SA 2.1 is monitoring what is written in the override script! You can even go back and forth on this scenario and face the same behavior. If you remove the part you've added manually to the override script, the "requires" statement disappears and retyping the missing parts will bring it back.
That was my understanding of this bug. I hope it can help you fix it.


23 Aug 2012, 8:35 AM
I love/hate when a bug is a feature!

Yes if you don't actually add code to the default override (you didn't really use it) we don't include the requires in the base file.

The base file requires the override on purpose but the framework queues it and doesn't load it until after the base is loaded.

By "they can't be opened" are you referring to don't load up in the browser correctly? Maybe we have a disconnect here.

25 Aug 2012, 4:17 AM
Here I have supplied a new attachment. Please open it in Sencha Architect and deploy it in a folder. If you open the "app.html" in a browser you'll see a blank page. But if you remove the "requires" statement from "app/view/Desktop/TrayClock.js" you'll be able to see a toolbar at the bottom of page.

This shows the bug that I meant.


27 Aug 2012, 10:40 PM
Would someone please let me know if this issue has been identified as a bug or I should overcome the problem on my own?

28 Aug 2012, 6:32 AM
Yes sorry about this. We decided this was something we could and should fix. The next patch (soon) will have an upgrade to fix these.

28 Aug 2012, 6:50 AM
Thanks, I hope it won't be long before its patch comes out.

28 Aug 2012, 6:55 AM
I've tested BrokenOverride.xda with the overrides upgrade and it works well.

Ext.define('BrokenOverride.view.override.Desktop.TrayClock', {
override: 'BrokenOverride.view.Desktop.TrayClock',
initComponent: function() {
var me = this;

30 Aug 2012, 10:33 PM
Thanks for the tip Phil. It would be nice if this is mentioned some where so others won't face my problem. Like a blog post or something.

Thank you again,