Skip to content

Remove all beforeEach, afterEach, beforeResolve #2341

Closed
@mistersender

Description

Version

3.0.1

Reproduction link

https://jsfiddle.net/se6gLaqn/1/

Steps to reproduce

Create a vue instance, as well as a router instance. Then destroy the vue instance.

The router instance continues to exist and fire.

What is expected?

The router should be able to properly destroy itself; either by explicit call, or when the vue instance is destroyed

What is actually happening?

The router exists and cannot be destroyed


I did some googling and see that vue-router cannot currently be destroyed, but I am asking for reconsideration. Unlike the other issue I found (#954) where it appeared the user wanted to destroy and create a new router in the same application, the issue I am having is completely separate.

I have a massive application that essentially uses pjax methodologies to be able to run several SPAs (vue being one) that create the full site. When we navigate away from one SPA to another, the SPA needs to destroy itself so it's code does not interfere with the other SPAs. However, because the vue router cannot be destroyed; it's attempting to execute logic for routing even when the SPA that created it is destroyed. The issue compounds when we have more than 1 vue application running, as there are now 2 instances of vue-router (or more) running at a time.

Specifically, we are using the hash version of routing. It looks like the router just attaches an event to the window and listens for popstates, but things get weird when more than one event does something with popstate (an understandably oddball behavior). I would appreciate reconsideration for allowing vue-router to destroy itself when appropriate. Thanks!

[edited for spelling/grammar]

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