Skip to content

Commit a73b0bc

Browse files
committed
fix: get/set better handle ref, closes #1427
1 parent 944db7e commit a73b0bc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/app-backend-vue3/src/components/data.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,7 @@ export function editState ({ componentInstance, path, state, type }: HookPayload
286286
const currentValue = get(componentInstance.devtoolsRawSetupState, path)
287287
if (currentValue != null) {
288288
const info = getSetupStateInfo(currentValue)
289-
290289
if (info.readonly) return
291-
if (info.ref) {
292-
targetPath.splice(1, 0, 'value')
293-
}
294290
}
295291
} else {
296292
target = componentInstance.proxy

packages/shared-utils/src/util.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,10 @@ export function set (object, path, value, cb = null) {
630630
const sections = Array.isArray(path) ? path : path.split('.')
631631
while (sections.length > 1) {
632632
object = object[sections.shift()]
633+
// Vue 3 ref
634+
if (object?.__v_isRef) {
635+
object = object.value
636+
}
633637
}
634638
const field = sections[0]
635639
if (cb) {
@@ -643,6 +647,10 @@ export function get (object, path) {
643647
const sections = Array.isArray(path) ? path : path.split('.')
644648
for (let i = 0; i < sections.length; i++) {
645649
object = object[sections[i]]
650+
// Vue 3 ref
651+
if (object?.__v_isRef) {
652+
object = object.value
653+
}
646654
if (!object) {
647655
return undefined
648656
}

0 commit comments

Comments
 (0)