-
-
Notifications
You must be signed in to change notification settings - Fork 241
fix(NativeScriptPlatformRef): Destroy lastModuleRef on exitEvent #1728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(NativeScriptPlatformRef): Destroy lastModuleRef on exitEvent #1728
Conversation
test |
LGTM - triggered the CI. |
test |
…escript-angular into fix/923-module-not-destroyed
@cla-bot check |
The cla-bot has been summoned, and re-checked this pull request! |
Hi @vakrilov, I just noticed a problem On Android 9.
This will have triggered an exit event and tried to destroy the angular application, but it is still running. You can see the problem here:
I print out the app events: JS: suspend # Leave the app to change the font size
JS: activityPaused
JS: activityStopped
JS: orientationChanged # Font size changed in while I'm in settings
JS: exit # Returned to the app
JS: activityDestroyed
JS: activityCreated
JS: activityStarted
JS: activityResumed
JS: resume
JS: displayed
JS: displayed |
If exit event was triggered twice we would try to destroy an already destroy module ref.
…escript-angular into fix/923-module-not-destroyed
Don't destroy the angular module on restart
I solved the problem. The I added a test for this case in the |
test |
Tests for the changes are included.Don't see howWhat is the current behavior?
The application module isn't destroyed when the application exitEvent is triggered.
This causes the previous instance of the nativescript-angular app to be running in a sleep state and
ngOnDestroy()
on it's compoments, services etc. are not called as expected.What is the new behavior?
Adds an event listener for the
exitEvent
in theNativeScriptPlatformRef
which destroys thelastModuleRef
which triggersngOnDestroy()
as expected.Fixes #923