[ALOY-880] Improve error reporting on duplicate alloy controller id
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2014-02-10T20:29:13.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2014 Sprint 03 |
Components | Tooling |
Labels | alloy, controller, error |
Reporter | Lee Driscoll |
Assignee | Tim Poulsen |
Created | 2013-11-07T15:25:10.000+0000 |
Updated | 2018-03-07T22:28:25.000+0000 |
Description
Hi =]
I had the following structure (note the duplicated id: 'scheduler'):
index.xml
<Alloy>
<TabGroup>
<Tab title="Scheduler">
<Require src="scheduler" id="scheduler" />
</Tab>
<Tab title="Job List">
<Require src="jobList" id="jobList" />
</Tab>
</TabGroup>
</Alloy>
scheduler.xml
<Alloy>
<Window title="Scheduler" navBarHidden="false" layout="vertical">
<Widget src="uk.co.ibcos.scheduler" dataProvider="jobData" id="scheduler" />
</Window>
</Alloy>
The error I received back came from alloy/controllers/BaseController.js line 36 :
"cannot read property '__iamalloy' of undefined"
The problem was that the duplicate id prevented one of the scheduler controllers to have an undefined value as it's 'parent' property.
A check should occur somewhere sooner to warn that a duplicate id has been defined.
[~lsdriscoll] There is actually a warning message output. It's probably just that there's a lot of build messages that go by so that it's easy to miss it.
I used a label instead of a widget in my test app. Hence, I wouldn't get the same code error you saw. Instead, for me the label simply doesn't appear. Either way, the root cause is the same -- the child element is using the parent Window's id (which is assigned an id based on the file name since one isn't explicitly specified). I'm closing this as invalid. Reopen this ticket if you think I'm wrong in that assessment.
Closing as invalid. If this is incorrect, please reopen.