Skip to content

Commit 65d3f3c

Browse files
fix(ssr): Memory leak in poll method (fix #vuejs#2606).
1 parent d907a13 commit 65d3f3c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/history/base.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,14 @@ export class History {
177177
}
178178

179179
runQueue(queue, iterator, () => {
180+
const app = this.router.app
180181
const postEnterCbs = []
181-
const isValid = () => this.current === route
182+
const isValid = () => {
183+
if (app && app._isBeingDestroyed) {
184+
return false
185+
}
186+
return this.current === route
187+
}
182188
// wait until async components are resolved before
183189
// extracting in-component enter guards
184190
const enterGuards = extractEnterGuards(activated, postEnterCbs, isValid)
@@ -189,8 +195,8 @@ export class History {
189195
}
190196
this.pending = null
191197
onComplete(route)
192-
if (this.router.app) {
193-
this.router.app.$nextTick(() => {
198+
if (app) {
199+
app.$nextTick(() => {
194200
postEnterCbs.forEach(cb => {
195201
cb()
196202
})

0 commit comments

Comments
 (0)