8000 fix: SSR renderComponent computed error, #464 (#465) · vuejs/composition-api@123e60e · GitHub
[go: up one dir, main page]

Skip to cont 8000 ent

Commit 123e60e

Browse files
authored
fix: SSR renderComponent computed error, #464 (#465)
1 parent 6b9b33c commit 123e60e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/apis/computed.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function computed<T>(
3838
let computedSetter
3939
let computedGetter
4040

41-
if (vm) {
< 851F /code>41+
if (vm && !vm.$isServer) {
4242
const { Watcher, Dep } = getVueInternalClasses()
4343
let watcher: any
4444
computedGetter = () => {
@@ -75,6 +75,8 @@ export function computed<T>(
7575
},
7676
})
7777

78+
vm && vm.$on('hook:destroyed', () => computedHost.$destroy())
79+
7880
computedGetter = () => (computedHost as any).$$state
7981
computedSetter = (v: T) => {
8082
if (__DEV__ && !set) {

0 commit comments

Comments
 (0)
0