Teardown pages

6 views
Skip to first unread message

Shell (Aridhia Informatics)

unread,
Mar 19, 2014, 7:38:55 AM3/19/14
to choru...@googlegroups.com
We have a custom page that has several intensive subviews and we relying on 'passive' teardown as the user moves around the application. Yesterday we discovered that some of these subviews are 'leaking' methods into the global application. In particular, we added some focus/blur handling to custom scrolling we have in the subviews (hooked into jScrollpane) and discovered that these events are being triggered *outside* of our page's subviews.

I looked at the dev docs around teardown in the Chorus project but it doesn't seem to be quite what we need. Can anyone recommend any other policies for ensuring a *page view* and/or its subviews are correctly destroyed when navigated away from by the user?

I suspect we're just missing a trick or we have some other scoping issue >.<

Charles Hansen

unread,
Mar 19, 2014, 4:49:46 PM3/19/14
to choru...@googlegroups.com
Not sure what are in the docs, but there are two likely failure points with teardown I remember.  

1)  The teardown method is not actually being called.  This usually happens because you created something that behaves like a subview without registering it.  Parents only tear down children that are created from the subview hash or that have been registered.  This can be tested by putting a debugger in the teardown method of the view in question.  If you are doing something crazy in the router, it is possible that the page itself isn't being torn down, but I would be surprised.

2)  The subview creates a binding that is not removed by the teardown function.  There is no generic 'remove all bindings' function, but the base teardown method gives it it's best shot.  If you have created a binding that the base teardown method does not remove, you need to add something to the teardown method of the view that creates that binding.  I believe that jScrollpane events are not unbound by the default teardown because there was no generic way to target them without unbinding all of the scrollbars on the whole page.

Hope that helps,
Charles


--
You received this message because you are subscribed to the Google Groups "chorus-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chorus-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shell Bryson

unread,
Mar 19, 2014, 6:36:30 PM3/19/14
to choru...@googlegroups.com
Hi Charles,

That helps a great deal. I will delve back into the code tomorrow as I think I know exactly what the problem is now. I’ll post a confirmation once I have it working as expected.

Thanks,

S.
Reply all
Reply to author
Forward
0 new messages