Skip to content

Clearing navigation stack with clearHistory does not destroy components #339

@lsapan

Description

@lsapan

Version

2.0.0

Reproduction link

https://play.nativescript.org/?template=play-vue&id=U02vb8&v=2

Platform and OS info

iOS 12 / NativeScript 5 (and presumably 4 in Playground) / macOS Mojave

Steps to reproduce

The repro sample is a simple three step "app". Once you finish the third step, it takes you back to the first.

From Step 1, tap the next button. In Step 2, hit the back button. Notice how Step 2 is properly destroyed (as noted in the console).

Now, tap through to Step 3, and hit the start over button. This pushes a new Step 1 on while clearing the history (note the lack of a back button). However, the prior steps are not destroyed.

What is expected?

The prior views should be destroyed when clearing the navigation stack.

What is actually happening?

The prior views become unreachable, but stick around.


Obviously in this app it isn't a big deal that the views become ghosts. However in practice, a vuex store may be involved, causing issues when views that expect a certain state suddenly see the state change (when they shouldn't be around anymore).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions