Skip to content

Commit 0b8c673

Browse files
committed
cache partial based on constructor id
1 parent 1da494a commit 0b8c673

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/element-directives/partial.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ module.exports = {
4848
_.assertAsset(partial, 'partial', id)
4949
if (partial) {
5050
var frag = templateParser.parse(partial, true)
51-
var linker = this.compile(frag, partial)
51+
// cache partials based on constructor id.
52+
var cacheId = (this.vm.constructor.cid || '') + partial
53+
var linker = this.compile(frag, cacheId)
5254
// this is provided by v-if
5355
this.link(frag, linker)
5456
}
5557
},
5658

57-
compile: function (frag, partial) {
58-
var hit = cache.get(partial)
59+
compile: function (frag, cacheId) {
60+
var hit = cache.get(cacheId)
5961
if (hit) return hit
6062
var linker = compiler.compile(frag, this.vm.$options, true)
61-
cache.put(partial, linker)
63+
cache.put(cacheId, linker)
6264
return linker
6365
},
6466

0 commit comments

Comments
 (0)