PDA

View Full Version : [OPEN] userAlias with a dot is rejected



Artur Bodera (Joust)
19 Apr 2012, 5:37 AM
Import from old Ext Designer into "Architect" was successful.

Unfortunatelly Architect keeps erasing userAlias properties of my components, because it disallows "." in userAlias name.

There is nothing wrong in using a dot in aliases and I've been doing that for a year now. It's most commonly used in mid to large apps with different modules, where aliases would otherwise overlap (i.e. "users.Grid" != "products.Grid" alias).

Please fix it!

Phil.Strong
19 Apr 2012, 6:11 AM
Artur,

I'll look into this. Get you a response soon.

Schlurcher
7 Oct 2012, 2:59 PM
I hate to necro old threads, but it seems this issue still has not been resolved. If it's by design a short explanation wouldn't hurt either.

Artur Bodera (Joust)
8 Oct 2012, 12:44 AM
It's just an old, abandoned bug ... not really "necro" since it's still OPEN, as in not-fixed :)

Phil.Strong
9 Oct 2012, 12:15 PM
I believe that this is not allowed by the framework and/or the loader itself. Typically a dot denotes folder structure

MyApp.views.donkey
~/views/donkey.js

MyApp.views.donkey.boy
~/views/donkey/boy.js

Phil.Strong
9 Oct 2012, 12:22 PM
Cancel that I was looking at userClassName which would refer to the above.

from the docs on Ext JS 4 - Using a dot in the alias other than the name will cause Ext.ComponentQuery.query to fail on that alias. For example alias: 'widget.sencha.coolpanel'. Using Ext.ComponentQuery.query('sencha.coolpanel') will not work. See http://www.sencha.com/forum/showthread.php?132643-EXTJSIV-1804-Ext.ComponentQuery.query%28%29-for-ItemId-s-xtypes-containing-./page3 for more details.

http://www.sencha.com/forum/showthread.php?142837-Selecting-components-with-Ext.ComponentQuery.query()-with-dots-in-alias

Not sure if it works now. Clearly this is a bug but I'm not sure the framework team intended namespaces outside of widget, store, model (predefined ones)


List of short aliases for class names.

Artur Bodera (Joust)
9 Oct 2012, 9:31 PM
Yes Phil.
It's a nasty, old, stinky bug.

I use dot aliases since Ext 3, because they're essential for a modular app or one with tens of widgets.

The following works perfectly in Ext 4.x, even though that Architect thingy is lacking:


// inside a class
alias: 'widget.contacts.ContactEvents', // I have those everywhere...

// inside a controller:
views: ['contacts.ContactEvents' ... ]

// later:
items: [{ xtype: 'contacts.ContactEvents' ... }]

Phil.Strong
16 Oct 2012, 10:42 AM
A workaround would be to change those dots to underscore

contacts_ContactEvents

not perfect I know. If this bug is fixed I'd say for sure we should get this in there but I don't want to add a feature that can also introduce a bug.

Artur Bodera (Joust)
16 Oct 2012, 11:42 AM
So basically:
- "yes, it's a bug, we won't fix it and we don't care"

Need I remind you, that it's something that was broken with the introduction of Architect ? It was working fine with "Designer". If in doubt, just install "Ext Designer" and type in any alias with a dot. Worked perfectly.

Phil.Strong
18 Oct 2012, 6:29 AM
I never ever said I didn't care. Nothing could be further from the truth.

Mitchell Simoens is looking into whether it's still a CQ bug in most current SDKs (Ext JS 4.0.x,Ext JS 4.1.x, Touch 2.0.x, Touch 2.1.x)

If by miracle it's fixed then we'll turn it on.

Phil.Strong
18 Oct 2012, 6:35 AM
per Mitchell


4.1.2 won't find it and ST 2.1.0 RC2 will throw a warning in the console

Again turning this feature on would create many more bugs in others' projects so for now we simply cannot do it.

Phil.Strong
18 Oct 2012, 6:42 AM
Mitchell and I had a revelation which is to say that controllers, stores, models do not have the same constraint set by ComponentQuery as views do.

In short we should able to allow for dots in stores, models, and controllers. I've put in a ticket for this sprint. Hopefully it will be in the next patch release.

mitchellsimoens
18 Oct 2012, 6:44 AM
Historically (Ext JS 3-) we have supported dots in the xtype of components but with the introduction to the alias throughout the frameworks this broke the usage of dots. So instead I have steered people into using underscores instead of dots which accomplishes the same things as a dot like "nesting" your xtype in a sort.

I just tested this component in Ext JS 4.1.2 and Sencha Touch 2.1.0 RC2:


Ext.define('MyView', {
extend : 'Ext.Component',
xtype : 'my.view'
});

And neither framework supports it currently. We do have an internal bug filed for Ext JS 4 (EXTJSIV-2577 for any other Sencha employee looking at this) and it looks like it may get fixed for 4.2.0 but it's currently an open bug ticket. So we want to support it once again and will support it but it's not a blocker bug as you can use characters like an underscore.

So Architect isn't allowing it because the frameworks don't support it currently for components. Technically things like stores and plugins use the alias like a component does but since ComponentQuery is what breaks things for components but is not used for other classes that support alias, technically dots should be valid for those classes just not for components.

Artur Bodera (Joust)
18 Oct 2012, 6:59 AM
Leave xtype for now.

Here's the case:



Ext.define('NS.something.Potato', {
extend: 'NS.something.Veggie',
alias: 'widget.veggies.Potato'
});

// later in some other component, i.e. a container:
items: [
{
xtype: 'veggies.Potato',
itemId: 'BrownOne'
}
]


Works perfectly since 3.0 all through 4.1.x. I've built whole app with tens of widgets, panels, etc. and they are namespaced because of the sheer number of those. Ext Designer handled the task with no problem, while Architect refuses to digest the dot for some reason (even though after manually editing and adding the dot, all works well).

mitchellsimoens
18 Oct 2012, 7:27 AM
Correct but that's just half of the story. Resolving that component will not work therefore we cannot say it's fully working and can then understand why Architect does not allow for it.

Artur Bodera (Joust)
23 Oct 2012, 2:32 AM
Correct but that's just half of the story. Resolving that component will not work therefore we cannot say it's fully working and can then understand why Architect does not allow for it.

This simply means we need to file a bug for CQuery, but this Architect bug still stands. As I've described above, component/container building and "Ext Designer" worked flawlessly. It's possible CQ bug has been introduced somewhere after 4.0.1.

mitchellsimoens
23 Oct 2012, 4:28 AM
There is already a bug open for ComponentQuery and I'm sure once this is fixed they will allow it in Architect. There was already a bug open for this that was linked to the bug for ComponentQuery.

Phil.Strong
24 Oct 2012, 9:09 AM
We've implemented a fix to allow for dots for models, stores, controllers in the next minor release.

Yes I know views would be nice as well but we'll be waiting or the CQ bug to be resolved before we allow them there. That ticket is tracking the framework tickets