Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kit): top level Proxy value inspect error cause inspection fail #701

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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