Skip to content

Commit

Permalink
fix(kit): top level Proxy value inspect error cause inspection fail
Browse files Browse the repository at this point in the history
  • Loading branch information
FoundTheWOUT committed Nov 16, 2024
1 parent 935a075 commit 45cbb54
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/devtools-kit/src/core/component/state/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,21 @@ export function sanitize(data: unknown) {
}

export function getSetupStateType(raw) {
return {
ref: isRef(raw),
computed: isComputed(raw),
reactive: isReactive(raw),
readonly: isReadOnly(raw),
try {
return {
ref: isRef(raw),
computed: isComputed(raw),
reactive: isReactive(raw),
readonly: isReadOnly(raw),
}
}
catch {
return {
ref: false,
computed: false,
reactive: false,
readonly: false,
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions packages/playground/basic/src/pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ function trigger() {
}
const toRefObj = toRefs(obj)
const topLevelProxy = new Proxy({
foo() {
return 'foo'
},
}, {
get(target, key) {
return target[key]()
},
})
</script>

<template>
Expand Down

0 comments on commit 45cbb54

Please sign in to comment.