Skip to content

Commit 62d0aa7

Browse files
committed
feat(vue3): improved setup inspect
1 parent b3a232e commit 62d0aa7

File tree

1 file changed

+20
-6
lines changed
  • packages/app-backend-vue3/src/components

1 file changed

+20
-6
lines changed

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

+20-6
Original file line numberDiff line numberDiff line change
@@ -130,29 +130,34 @@ function processSetupState (instance) {
130130

131131
let result: any
132132

133+
let isOther = typeof value === 'function' ||
134+
typeof value?.render === 'function' ||
135+
typeof value?.__asyncLoader === 'function'
136+
133137
if (rawData) {
134138
const info = getSetupStateInfo(rawData)
135139

136140
const objectType = info.computed ? 'Computed' : info.ref ? 'Ref' : info.reactive ? 'Reactive' : null
137141
const isState = info.ref || info.computed || info.reactive
138-
const isOther = typeof value === 'function' || typeof value?.render === 'function'
139142
const raw = rawData.effect?.raw?.toString() || rawData.effect?.fn?.toString()
140143

144+
if (objectType) {
145+
isOther = false
146+
}
147+
141148
result = {
142149
...objectType ? { objectType } : {},
143150
...raw ? { raw } : {},
144151
editable: isState && !info.readonly,
145-
type: isOther ? 'setup (other)' : 'setup',
146-
}
147-
} else {
148-
result = {
149-
type: 'setup',
150152
}
151153
}
152154

155+
const type = isOther ? 'setup (other)' : 'setup'
156+
153157
return {
154158
key,
155159
value,
160+
type,
156161
...result,
157162
}
158163
})
@@ -207,6 +212,15 @@ export function getCustomObjectDetails (object: any, proto: string): CustomState
207212
},
208213
}
209214
}
215+
216+
if (typeof object.__asyncLoader === 'function') {
217+
return {
218+
_custom: {
219+
type: 'component-definition',
220+
display: 'Async component definition',
221+
},
222+
}
223+
}
210224
}
211225

212226
/**

0 commit comments

Comments
 (0)