#13784 closed defect (fixed)
lazy loading of dojo/dnd/Source via require results in uncaught exception
Reported by: | Adam Peller | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | Loader | Version: | 1.6.1 |
Keywords: | Cc: | ykami | |
Blocked By: | Blocking: |
Description (last modified by )
Uncaught TypeError: Cannot read property 'Source' of undefined
from AutoSource.js, line 3
the shim in Source.js loads compatibility code in a dojo.ready. If Source.js is loaded after page load, this executes immediately, resulting in a circular dependency. AutoSource extends Source, and Source hasn't finished loading yet. Is it as simple as putting the shim after the declare?
Attachments (1)
Change History (13)
comment:1 Changed 10 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 10 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 10 years ago by
Description: | modified (diff) |
---|
comment:4 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:5 Changed 10 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
ok, I think I got a real test case this time.
comment:6 Changed 10 years ago by
Owner: | changed from bill to Rawld Gill |
---|---|
Status: | reopened → new |
Rawld, what do you think?
The problem only occurs when calling dojo.require() through eval().
But when using eval(), the require() call in dojo/dnd/Source.js executes immediately even though we are clearly in the middle of loading a module (and hence, not ready).
BTW, test case goes in dojo/tests/dnd
comment:7 Changed 9 years ago by
Cc: | ykami added |
---|---|
Component: | General → Loader |
Problem is now also occurring in dojox/mobile/tests/test_iPhone-IconMulti.html, after clicking the "Calendar" button (to show the Calendar). Clicking that button calls
dojo["require"](s)
where s == "dijit.form.Calendar", which loads dijit/form/_FormWidget.js, and then the dojo.ready() callback in _FormWidget.js runs immediately, rather than waiting until _FormWidget.js itself has finished loading.
// Back compat w/1.6, remove for 2.0 if(dojo && dojo.ready && !dojo.isAsync){ dojo.ready(0, function(){ var requires = ["dijit/form/_FormValueWidget"]; require(requires); // use indirection so modules not rolled into a build }); }
Calendar was changed recently in #13814 but ISTM that change is OK, and merely triggers this problem with the loader.
(Tested on FF5/mac.)
comment:8 Changed 9 years ago by
Priority: | normal → high |
---|
comment:9 Changed 9 years ago by
Status: | new → assigned |
---|
comment:11 Changed 9 years ago by
Verified that dijit.Calendar can be loaded and instantiated dynamically. Thank you for fixing this.
test case was invalid. the typo 'dojox' instead of 'dojo' caused the error. Still trying to find a case where the dojo.ready fires immediately.