fix(ssr): only cache computed getters during render phase

fix #5300
This commit is contained in:
Evan You
2022-01-21 12:31:54 +08:00
parent 25bc6549eb
commit 2f91872e7b
6 changed files with 75 additions and 9 deletions

View File

@@ -128,6 +128,12 @@ function renderComponentSubTree(
comp.ssrRender = ssrCompile(comp.template, instance)
}
// perf: enable caching of computed getters during render
// since there cannot be state mutations during render.
for (const e of instance.scope.effects) {
if (e.computed) e.computed._cacheable = true
}
const ssrRender = instance.ssrRender || comp.ssrRender
if (ssrRender) {
// optimized