smugmug / yui-gallery

SmugMug YUI gallery components.
http://smugmug.github.io/yui-gallery/api/
Other
22 stars 14 forks source link

TreeView: Including dependency for 'gallery-itsatoolbar' causes error. #29

Open davewallace opened 11 years ago

davewallace commented 11 years ago

Hi there,

I have 2 test files, one (which functions as expected) with these dependencies declared in the use() method: ['gallery-sm-treeview','gallery-sm-tree-lazy','editor']. http://codefinger.co.nz/public/yui/yui-editor-treeview/index2.html

The other test file is basically the same, but has the 'gallery-itsatoolbar' as an additional dependency: http://codefinger.co.nz/public/yui/yui-editor-treeview/index.html

With the second test file, I get this error in Chrome inspector: Uncaught TypeError: Cannot read property 'prototype' of undefined tree.js:743

So I'm unsure which module is causing the error, though the error is in tree.js, I might need to submit an issue with the creator of 'gallery-itsatoolbar', but I don't know sorry.

rgrove commented 11 years ago

Yep, you should contact the author of gallery-itsatoolbar.

ItsAsbreuk commented 11 years ago

Hey Ryan,

As creator of itsatoolbar, I dived into this, but the issue is not purely this module and seems far more complex. As far as I can see, it is the loader that causes this. If so, than it goes beyond my knowledge.

This is what I found out:

YUI.add('gallery-itsaselectlist', function (Y, NAME) {

Y.ITSASelectList = Y.Base.create('itsaselectlist', Y.Widget, [], );

}, '@VERSION@', {"requires": ["base-build", "widget"], "skinnable": false});
YUI.add('gallery-itsaselectlist', function (Y, NAME) {

Y.ITSASelectList = Y.Base.create('itsaselectlist', Y.Base, [], );

}, '@VERSION@', {"requires": ["base-build", "base-base"], "skinnable": false});

I hope it makes sense and you can reproduce the issue. Marco.

ItsAsbreuk commented 11 years ago

Thinking more about it: It might as well be the order of loading the modules. That is, it could be that the error only occurs if "widget" is loaded after gallery-sm-treeview. If I manually use YUI.add(), then it is loaded before.

rgrove commented 11 years ago

@ItsAsbreuk Thanks for digging in! I'm pretty busy with work right now, but I'll investigate as soon as I have time. This does sound like something weird in Loader.

ItsAsbreuk commented 11 years ago

You're welcome.

As far as I can see at this moment it is the order of loading the modules. The error-example puts the widgets-modules almost at the bottom: after 'tree' and before 'gallery-sm-tree'. Whereas the working examples have 'widget' loaded before 'tree'.

Perhaps you'll find Y.Widget to insert extra items in nodeExtensions[] after Tree is initialized, because it error on line https://github.com/yui/yui3/blob/master/build/tree/tree-debug.js#L761, saying 'nodeExtentions[i]' is undefined.

Anyway, good luck.

Marco.