Skip to content

Commit bec47a7

Browse files
authored
fix(vue2): Use the super constructor when the instance is a VueComponent (#1690)
1 parent b3dd744 commit bec47a7

File tree

1 file changed

+11
-1
lines changed
  • packages/app-backend-core/src

1 file changed

+11
-1
lines changed

packages/app-backend-core/src/app.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,16 @@ export async function removeApp (app: App, ctx: BackendContext) {
221221
}
222222
}
223223

224+
// eslint-disable-next-line camelcase
225+
function _legacy_getVueFromApp (app) {
226+
if (app.constructor.name === 'VueComponent') {
227+
// When Vue.extend is used the component is an instance of VueComponent instead of Vue.
228+
// VueComponent has a property super which points to the original Vue constructor
229+
return app.constructor.super
230+
}
231+
return app.constructor
232+
}
233+
224234
// eslint-disable-next-line camelcase
225235
export async function _legacy_getAndRegisterApps (ctx: BackendContext) {
226236
// Remove apps that are legacy
@@ -232,7 +242,7 @@ export async function _legacy_getAndRegisterApps (ctx: BackendContext) {
232242

233243
const apps = scan()
234244
apps.forEach(app => {
235-
const Vue = app.constructor
245+
const Vue = _legacy_getVueFromApp(app)
236246
registerApp({
237247
app,
238248
types: {},

0 commit comments

Comments
 (0)