From 169a5a64e9505dd2092e0a98145ee73739d27448 Mon Sep 17 00:00:00 2001 From: Peach Date: Tue, 3 Jul 2018 02:48:55 +0800 Subject: [PATCH] Fix instance reuse bug in out-in transition #1874 (#2127) **What kind of change does this PR introduce?** (check at least one) - [x] Bugfix - [ ] Feature - [ ] Code style update - [ ] Refactor - [ ] Build-related changes - [ ] Other, please describe: **Does this PR introduce a breaking change?** (check one) - [ ] Yes - [x] No If yes, please describe the impact and migration path for existing applications: **The PR fulfills these requirements:** - [x] It's submitted to the `dev` branch for v2.x (or to a previous version branch), _not_ the `master` branch - [x] When resolving a specific issue, it's referenced in the PR's title (e.g. `fix #xxx[,#xxx]`, where "xxx" is the issue number) - [x] All tests are passing: https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md#development-setup - [ ] New/updated tests are included If adding a **new feature**, the PR's description includes: - [ ] A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it) **Other information:** This is a PR for #1874 , cc: @LinusBorg --- src/history/base.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/history/base.js b/src/history/base.js index 0c90dafa7..5b6f199c6 100644 --- a/src/history/base.js +++ b/src/history/base.js @@ -318,7 +318,10 @@ function poll ( key: string, isValid: () => boolean ) { - if (instances[key]) { + if ( + instances[key] && + !instances[key]._isBeingDestroyed // do not reuse being destroyed instance + ) { cb(instances[key]) } else if (isValid()) { setTimeout(() => {