8000 feat(history): Reset history.current when all apps are destroyed by nightnei · Pull Request #3298 · vuejs/vue-router · GitHub
[go: up one dir, main page]

Skip to content

feat(history): Reset history.current when all apps are destroyed #3298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 31, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor: general History.teardown method
  • Loading branch information
nightnei committed Aug 26, 2020
commit b95e6702c75f5c85c6d4ef6b82e84f42df05c6ba
9 changes: 1 addition & 8 deletions src/history/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,26 +252,19 @@ export class History {
// Default implementation is empty
}

teardownListeners () {
teardown () {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we rename this method, it might make sense to rename the setupListeners method, too.

setupListeners () {

// clean up event listeners
// https://github.com/vuejs/vue-router/issues/2341
this.listeners.forEach(cleanupListener => {
cleanupListener()
})
this.listeners = []
}

resetHistoryState () {
// reset current history route
// https://github.com/vuejs/vue-router/issues/3294
this.current = START
this.pending = null
}

teardown () {
this.teardownListeners()
this.resetHistoryState()
}
}

function normalizeBase (base: ?string): string {
Expand Down
0