File tree Expand file tree Collapse file tree 4 files changed +37
-8
lines changed
applet/src/components/state
devtools-kit/src/core/component/state
playground/basic/src/pages Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -279,4 +279,13 @@ async function submitDrafting() {
279279 --at-apply : ' text-#aaa' ;
280280 }
281281}
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+ }
282291 </style >
Original file line number Diff line number Diff line change @@ -139,8 +139,8 @@ function processSetupState(instance: VueAppInstance) {
139139 const value = returnError ( ( ) => toRaw ( instance . setupState [ key ] ) ) as unknown as {
140140 render : Function
141141 __asyncLoader : Function
142-
143142 }
143+ const accessError = value instanceof Error
144144
145145 const rawData = raw [ key ] as {
146146 effect : {
@@ -151,13 +151,14 @@ function processSetupState(instance: VueAppInstance) {
151151
152152 let result : Partial < InspectorState >
153153
154- let isOtherType = typeof value === 'function'
154+ let isOtherType = accessError
155+ || typeof value === 'function'
155156 || ( ensurePropertyExists ( value , 'render' ) && typeof value . render === 'function' ) // Components
156157 || ( ensurePropertyExists ( value , '__asyncLoader' ) && typeof value . __asyncLoader === 'function' ) // Components
157158 || ( typeof value === 'object' && value && ( 'setup' in value || 'props' in value ) ) // Components
158159 || / ^ v [ A - Z ] / . test ( key ) // Directives
159160
160- if ( rawData ) {
161+ if ( rawData && ! accessError ) {
161162 const info = getSetupStateType ( rawData )
162163
163164 const { stateType, stateTypeName } = getStateTypeAndName ( info )
Original file line number Diff line number Diff line change @@ -72,11 +72,21 @@ export function sanitize(data: unknown) {
7272}
7373
7474export 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+ }
8090 }
8191}
8292
Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ function trigger() {
2222}
2323
2424const 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+ })
2534 </script >
2635
2736<template >
You can’t perform that action at this time.
0 commit comments