Titanium JIRA Archive
Alloy (ALOY)

[ALOY-880] Improve error reporting on duplicate alloy controller id

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2014-02-10T20:29:13.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 03
ComponentsTooling
Labelsalloy, controller, error
ReporterLee Driscoll
AssigneeTim Poulsen
Created2013-11-07T15:25:10.000+0000
Updated2018-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.

Comments

  1. Tim Poulsen 2014-02-10

    [~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.
       [INFO]  [joblist.xml] view processing...
       [INFO]    view:       "joblist.xml"
       [WARN]  <Label> at line 3 is using this view's default ID "joblist". Only a top-level element in a view should use the default ID
       
    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.
  2. Eric Merriman 2018-03-07

    Closing as invalid. If this is incorrect, please reopen.

JSON Source