Skip to content

Commit

Permalink
fix: handle async component when parent is toggled before resolve (vu…
Browse files Browse the repository at this point in the history
  • Loading branch information
maoberlehner authored and Lostlover committed Dec 10, 2019
1 parent 65cca4c commit fb1e7b1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/core/vdom/helpers/resolve-async-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
isTrue,
isObject,
hasSymbol,
isPromise
isPromise,
remove
} from 'core/util/index'

import { createEmptyVNode } from 'core/vdom/vnode'
Expand Down Expand Up @@ -51,17 +52,21 @@ export function resolveAsyncComponent (
return factory.resolved
}

const owner = currentRenderingInstance
if (isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
// already pending
factory.owners.push(owner)
}

if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
return factory.loadingComp
}

const owner = currentRenderingInstance
if (isDef(factory.owners)) {
// already pending
factory.owners.push(owner)
} else {
if (!isDef(factory.owners)) {
const owners = factory.owners = [owner]
let sync = true

if (owner) owner.$on('hook:destroyed', () => remove(owners, owner))

const forceRender = (renderCompleted: boolean) => {
for (let i = 0, l = owners.length; i < l; i++) {
Expand Down

0 comments on commit fb1e7b1

Please sign in to comment.