Skip to content

Commit fdbd026

Browse files
authored
fix(customFormatter): properly accessing ref value during debugger (#12948)
1 parent 636a861 commit fdbd026

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/runtime-core/src/customFormatter.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
isReadonly,
55
isRef,
66
isShallow,
7+
pauseTracking,
8+
resetTracking,
79
toRaw,
810
} from '@vue/reactivity'
911
import { EMPTY_OBJ, extend, isArray, isFunction, isObject } from '@vue/shared'
@@ -34,13 +36,16 @@ export function initCustomFormatter(): void {
3436
if (obj.__isVue) {
3537
return ['div', vueStyle, `VueInstance`]
3638
} else if (isRef(obj)) {
39+
// avoid tracking during debugger accessing
40+
pauseTracking()
41+
const value = obj.value
42+
resetTracking()
3743
return [
3844
'div',
3945
{},
4046
['span', vueStyle, genRefFlag(obj)],
4147
'<',
42-
// avoid debugger accessing value affecting behavior
43-
formatValue('_value' in obj ? obj._value : obj),
48+
formatValue(value),
4449
`>`,
4550
]
4651
} else if (isReactive(obj)) {

0 commit comments

Comments
 (0)