diff --git a/src/core/instance/render.js b/src/core/instance/render.js index ca9cb938..d02f7d71 100644 --- a/src/core/instance/render.js +++ b/src/core/instance/render.js @@ -36,6 +36,13 @@ export function renderMixin (Vue: Class) { _parentVnode } = vm.$options + if (vm._isMounted) { + // clone slot nodes on re-renders + for (const key in vm.$slots) { + vm.$slots[key] = cloneVNodes(vm.$slots[key]) + } + } + if (staticRenderFns && !vm._staticTrees) { vm._staticTrees = [] } @@ -154,20 +161,14 @@ export function renderMixin (Vue: Class) { fallback: ?Array ): ?Array { let slotNodes = this.$slots[name] - if (slotNodes) { - // warn duplicate slot usage - if (process.env.NODE_ENV !== 'production') { - slotNodes._rendered && warn( - `Duplicate presense of slot "${name}" found in the same render tree ` + - `- this will likely cause render errors.`, - this - ) - slotNodes._rendered = true - } - // clone slot nodes on re-renders - if (this._isMounted) { - slotNodes = cloneVNodes(slotNodes) - } + // warn duplicate slot usage + if (slotNodes && process.env.NODE_ENV !== 'production') { + slotNodes._rendered && warn( + `Duplicate presense of slot "${name}" found in the same render tree ` + + `- this will likely cause render errors.`, + this + ) + slotNodes._rendered = true } return slotNodes || fallback }