Skip to content

Commit dd0d609

Browse files
committed
perf(ui): Improve caching
1 parent 56905b3 commit dd0d609

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

ui/src/utils/vm.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,11 @@ export function isVmChildOf (childVm, parentVm) {
2929
return false
3030
}
3131

32-
export function cache (vm, key, on) {
33-
if (isSSR === true) { return on }
32+
export function cache (vm, key, obj) {
33+
if (isSSR === true) return obj
3434

35-
const fullKey = key + '#' + Object.keys(on).join('#')
36-
37-
if (vm.$__cacheOn === void 0) {
38-
vm.$__cacheOn = {}
39-
}
40-
41-
if (vm.$__cacheOn[fullKey] === void 0) {
42-
vm.$__cacheOn[fullKey] = on
43-
}
44-
45-
return vm.$__cacheOn[fullKey]
35+
const k = `__qcache_${key}`
36+
return vm[k] === void 0
37+
? (vm[k] = obj)
38+
: vm[k]
4639
}

0 commit comments

Comments
 (0)