Skip to content
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:(tabs/view-controller) keep changedetector #9578

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ export class Tabs extends Ion implements AfterViewInit {
}

selectedPage && selectedPage._didEnter();
deselectedPage && deselectedPage._didLeave();
const keepChangeDetectorAttached = !selectedTab.root;
deselectedPage && deselectedPage._didLeave(keepChangeDetectorAttached);

// track the order of which tabs have been selected, by their index
// do not track if the tab index is the same as the previous
Expand Down
4 changes: 2 additions & 2 deletions src/navigation/view-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,13 @@ export class ViewController {
* The view has finished leaving and is no longer the active view. This
* will fire, whether it is cached or unloaded.
*/
_didLeave() {
_didLeave(keepChangeDetectorAttached?: boolean) {
this.didLeave.emit(null);
this._lifecycle('DidLeave');

// when this is not the active page
// we no longer need to detect changes
if (!this._detached && this._cmp) {
if (!this._detached && this._cmp && !keepChangeDetectorAttached) {
this._cmp.changeDetectorRef.detach();
this._detached = true;
}
Expand Down