Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Router params unsubscribing required or not? #3003

@PEsteves8

Description

@PEsteves8

Some time ago the docs recommended that logic to unsubscribe route params should be included in the onDestroy hook.

However, that bit was removed, leading one to believe that that's not required anymore.

That said, expressions like: "we'll feed the Observable directly into our template using the AsyncPipe, which will handle unsubscribing from the Observable for us when the component is destroyed" or "The router offers a Snapshot alternative that gives us the initial value of the route parameters. We don't need to subscribe or unsubscribe. It's much simpler to write and read" are still present.

My point is that these excerpts indicate that unsubscribing onDestroy is actually still required.

So assuming that there is no need to unsubscribe on destroy, wouldn't it make more sense to change "We don't need to subscribe or unsubscribe." to just "We don't need to subscribe.", since we don't need to unsubscribe anyway?

NOTE: the assumption that unsubscribing using the onDestroy hook isn't necessary came from discussions in the gitter channel, where I was told that by an angular dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions