Skip to content

fix-next(frame): remove current entry fragment on reset root view #5533

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

Merged
merged 4 commits into from
Mar 14, 2018

Conversation

vchimev
Copy link
Contributor

@vchimev vchimev commented Mar 13, 2018

Problem:

When we reset root view and minimize/restore application with "Don't keep activities" turned ON, we try to restore the latest fragment. However, it is not available anymore, so could not be restored. In this case, remove it when changing root view in order to create a new one.

Steps to reproduce:

  • run the modal-navigation app
  • turn on the "Don't keep activities" setting in the Developer options for Android
  • tap on "Change root view" to set TabView as the application root
  • minimize and restore application

Stack trace:

System.err: Error: Cannot find Frame for NO ENTRY, FragmentClass{f14f72e #0 id=0x1 fragment0[0]}
System.err: File: "file:///data/data/org.nativescript.modalnavigation/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 651, column: 18
System.err: StackTrace:
System.err: 	Frame: function:'FragmentCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.modalnavigation/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 547, column: 23
System.err: 	Frame: function:'FragmentClass.onCreate', file:'file:///data/data/org.nativescript.modalnavigation/files/app/tns_modules/tns-core-modules/ui/frame/fragment.js', line: 24, column: 25
System.err: 	Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.modalnavigation/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 651, column: 19
System.err: 	Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.modalnavigation/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25

@vchimev
Copy link
Contributor Author

vchimev commented Mar 14, 2018

test branch_modal_navigation#vchimev/reset-root-view --ignore

@@ -176,6 +176,18 @@ export class Frame extends FrameBase {
}
}

_onRootViewReset(): void {
if (this._currentEntry && this._currentEntry.fragment) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract the common logic from _onRootViewReset() and onUnloaded() to avoid code duplication e.g. method cleanupCurrentFragment(...) / disposeCurrentFragment(...) or something like this.

Copy link
Contributor

@manoldonev manoldonev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After addressing comment for code duplication.

Extract the common logic from _onRootViewReset() and onUnloaded() methods to avoid code duplication.
@vchimev vchimev merged commit e43c754 into master Mar 14, 2018
@ghost ghost removed the in progress label Mar 14, 2018
@vchimev vchimev deleted the vchimev/reset-root-view branch March 14, 2018 17:56
@lock
Copy link

lock bot commented Aug 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants