Skip to content

Lifecycle only ever emits ON_PAUSE #39

@John-vd-Berg

Description

@John-vd-Berg

When a NavHostEntry is removed from the stack it only emits the ON_PAUSE lifecycle event to observers

Consider the following code:

val lifecycleOwner = LocalLifecycleOwner.current
DisposableEffect(lifecycleOwner) {
    val observer = LifecycleEventObserver { _, event ->
        println("Event: $event")
    }

    lifecycleOwner.lifecycle.addObserver(observer)

    onDispose {
        lifecycleOwner.lifecycle.removeObserver(observer)
    }
}

I would expect to receive ON_PAUSE > ON_STOP > ON_DESTROY when the entry is removed from the stack which is not the case. It would also be nice if some docs were added about how the library works in this area

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions