Skip to content

Component doesn't get destroyed on route change #1181

@huzjakd

Description

@huzjakd

Not sure if this is vue router problem or just vue. But when I switch back and forth between two routes, the component in one of the routes doesn't get destroyed. New instances just get created and each time I visit this route, method from this component get's called multiple times, on every visit method calls get increased by 1.
Here's a fiddle to demonstrate what I mean. Just switch between the two routes and watch the console. Logging the string "bbb" will increase by 1 every time.
What I want is every time I visit the second route ("/withsidebar"), string "bbb" should get logged only once.
https://jsfiddle.net/y2x8y9a7/

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