nativescript-angular icon indicating copy to clipboard operation
nativescript-angular copied to clipboard

PRO doesn't clear all outlets correctly

Open karsie opened this issue 4 years ago • 0 comments

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.8.0
  • Cross-platform modules:
  • Android Runtime:
  • iOS Runtime:
  • Plugin(s):
  • NativeScript-Angular: 8.21.0
  • Angular: 8.2.14

Describe the bug We use a PRO / nested PRO with tabview setup and when we navigate with clearHistory in one of the tabs, of all pages on the backStack in that PRO the ngOnDestroy is not called until the app is shut down. ngOnDestroy is called successfully on backbutton. After investigation we found out that not every navigation (a.k.a routeReuseStrategy.store) in a tab outlet is stored under the same outletKey, resulting in multiple outlet keys, but loadComponentInPage only clears the first outletKey.

To Reproduce Setup an angular app with a tabview, add a few navigations in a single tab with the last one a clearHistory: true, add logging to ngOnDestroy of every page. Check to see that not all ngOnDestroys have been called.

Expected behavior Every ngOnDestroy of every destroyed page should be called.

Sample project

Additional context We often subscribe/unsubscribe in ngOnInit/ngOnDestroy in pages, so this leads to memory leaks and observable leaks for us.

karsie avatar Nov 26 '20 14:11 karsie