File tree 4 files changed +37
-8
lines changed
applet/src/components/state
devtools-kit/src/core/component/state
playground/basic/src/pages
4 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -279,4 +279,13 @@ async function submitDrafting() {
279
279
--at-apply : ' text-#aaa' ;
280
280
}
281
281
}
282
+
283
+ // native error
284
+ :deep(.native.Error-state-type ) {
285
+ --at-apply : ' text-red-500' ;
286
+ & ::before {
287
+ content : ' Error:' ;
288
+ margin-right : 4px ;
289
+ }
290
+ }
282
291
</style >
Original file line number Diff line number Diff line change @@ -139,8 +139,8 @@ function processSetupState(instance: VueAppInstance) {
139
139
const value = returnError ( ( ) => toRaw ( instance . setupState [ key ] ) ) as unknown as {
140
140
render : Function
141
141
__asyncLoader : Function
142
-
143
142
}
143
+ const accessError = value instanceof Error
144
144
145
145
const rawData = raw [ key ] as {
146
146
effect : {
@@ -151,13 +151,14 @@ function processSetupState(instance: VueAppInstance) {
151
151
152
152
let result : Partial < InspectorState >
153
153
154
- let isOtherType = typeof value === 'function'
154
+ let isOtherType = accessError
155
+ || typeof value === 'function'
155
156
|| ( ensurePropertyExists ( value , 'render' ) && typeof value . render === 'function' ) // Components
156
157
|| ( ensurePropertyExists ( value , '__asyncLoader' ) && typeof value . __asyncLoader === 'function' ) // Components
157
158
|| ( typeof value === 'object' && value && ( 'setup' in value || 'props' in value ) ) // Components
158
159
|| / ^ v [ A - Z ] / . test ( key ) // Directives
159
160
160
- if ( rawData ) {
161
+ if ( rawData && ! accessError ) {
161
162
const info = getSetupStateType ( rawData )
162
163
163
164
const { stateType, stateTypeName } = getStateTypeAndName ( info )
Original file line number Diff line number Diff line change @@ -72,11 +72,21 @@ export function sanitize(data: unknown) {
72
72
}
73
73
74
74
export function getSetupStateType ( raw ) {
75
- return {
76
- ref : isRef ( raw ) ,
77
- computed : isComputed ( raw ) ,
78
- reactive : isReactive ( raw ) ,
79
- readonly : isReadOnly ( raw ) ,
75
+ try {
76
+ return {
77
+ ref : isRef ( raw ) ,
78
+ computed : isComputed ( raw ) ,
79
+ reactive : isReactive ( raw ) ,
80
+ readonly : isReadOnly ( raw ) ,
81
+ }
82
+ }
83
+ catch {
84
+ return {
85
+ ref : false ,
86
+ computed : false ,
87
+ reactive : false ,
88
+ readonly : false ,
89
+ }
80
90
}
81
91
}
82
92
Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ function trigger() {
22
22
}
23
23
24
24
const toRefObj = toRefs (obj )
25
+ const topLevelProxy = new Proxy ({
26
+ foo() {
27
+ return ' foo'
28
+ },
29
+ }, {
30
+ get(target , key ) {
31
+ return target [key ]()
32
+ },
33
+ })
25
34
</script >
26
35
27
36
<template >
You can’t perform that action at this time.
0 commit comments