ibm-js / dapp

AMD-based Application Framework for building Web & Mobile applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

View beforeDeactivate, afterDeactivate, beforeActivate, and afterActivate are not always called correctly for nested views.

edchat opened this issue · comments

I have added this issue which is a duplicate of dmachi/dojox_application#207 so that I could discuss this change more here before deciding if the change should be rolled back to 1.9.

The original problem being reported was that when leaving a nested view it's afterDeactivate method could be called multiple times without having been reactivated.

What I found in my testing was that there were cases where the beforeDeactivate, beforeActivate, afterDeactivate and afterActivate methods were not always called on the parent views.

I also discovered that with nested views resize was being called multiple times unnecessarily, and that LayoutBase was not always setting viewShowing = true when necessary.

One of the problems was being caused by a race condition in the Transition controller, which was caused by the recursive calls to _doTransition for nested views. The recursion for nested views was not necessary, and it made the flow in the Transition controller much harder to follow, so I removed the recursive calls for nested views and simplified the code. I also broke things out much more into methods which could be overridden in case someone wants to create a custom Transition controller extending the provided one.

Closing this, I merged the change without using this pull request to avoid multiple commits for this.
The merge was done here:
9d2201b