tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/231-automatic-creationremoval-of-mediatorsRobotlegs: Discussion 2018-10-18T16:35:20Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/42363802010-12-13T09:31:17Z2010-12-13T09:31:17ZAutomatic creation/removal of mediators <div><p>Hi Stefan,</p>
<p>I've never had any difficulty with the auto-magic creation /
destruction of mediators for views added and removed within any
child or grandchild (or great-great-great grandchild etc) of the
contextView.</p>
<p>The added/removed events bubble, so the intent is that any view
within contextView can be mediated, even if deeply nested.</p>
<p>Are you hitting a specific bug? Or just unsure how it would
work?</p>
<p>Stray</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/42363802010-12-13T09:37:40Z2010-12-13T09:37:40ZAutomatic creation/removal of mediators <div><p>Hey there Stray,</p>
<p>I've looked into this further and discovered that, in my
situation, an overridden 'stage' getter in my component base class
was causing the issue. The stage getter was always returning a
valid reference to the top level stage so the removal was never
being initiated by RL.</p>
<p>Thanks for following up.</p>
<p>Stefan</p></div>Stefan Vizzaritag:robotlegs.tenderapp.com,2009-10-18:Comment/42363802010-12-13T10:41:49Z2010-12-13T10:41:49ZAutomatic creation/removal of mediators <div><p>Ah - that makes sense. It's a good 'gotcha' for the wiki as well
- is the description below correct?</p>
<hr>
<p>[Problem]</p>
<p>View items were not having their mediators destroyed
automatically when the view was removed from the stage.</p>
<p>[Cause]</p>
<p>The view items had an overridden getter for the stage property.
The automatic mediator removal system relies on this reference
being null (or coercing to false) in order to proceed with
removal.</p>
<p>[Solution]</p>
<p>Check that your view class, including any base class it extends,
will return null or false for the stage property when not added to
the stage.</p>
<hr>
<p>If you could edit it if it's not correct that would be
great.</p>
<p>Thanks,</p>
<p>Stray</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/42363802010-12-13T11:06:35Z2010-12-13T11:06:35ZAutomatic creation/removal of mediators <div><p>Nope, nothing to add, that’s a robust description ;)</p></div>Stefan Vizzaritag:robotlegs.tenderapp.com,2009-10-18:Comment/42363802010-12-13T11:18:11Z2010-12-13T11:18:11ZAutomatic creation/removal of mediators <div><p>Cheers!</p></div>Stray