Skip to content

Commit

Permalink
fix(core): static trees should be cached on options (vuejs#6826)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkzing committed Oct 18, 2017
1 parent d22d596 commit f8511d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/instance/render-helpers/render-static.js
Expand Up @@ -11,8 +11,8 @@ export function renderStatic (
): VNode | Array<VNode> {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
const renderFns = this.$options.staticRenderFns
const cached = renderFns.cached || (renderFns.cached = [])
const options = this.$options
const cached = options.cached || (options.cached = [])
let tree = cached[index]
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
Expand All @@ -22,7 +22,7 @@ export function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this)
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this)
markStatic(tree, `__static__${index}`, false)
return tree
}
Expand Down

0 comments on commit f8511d1

Please sign in to comment.