Skip to content

fix(vue2): Use the super constructor when the instance is a VueComponent #1690

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

Merged
merged 1 commit into from
Feb 9, 2022
Merged
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
12 changes: 11 additions & 1 deletion packages/app-backend-core/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ export async function removeApp (app: App, ctx: BackendContext) {
}
}

// eslint-disable-next-line camelcase
function _legacy_getVueFromApp (app) {
if (app.constructor.name === 'VueComponent') {
// When Vue.extend is used the component is an instance of VueComponent instead of Vue.
// VueComponent has a property super which points to the original Vue constructor
return app.constructor.super
}
return app.constructor
}

// eslint-disable-next-line camelcase
export async function _legacy_getAndRegisterApps (ctx: BackendContext) {
// Remove apps that are legacy
Expand All @@ -232,7 +242,7 @@ export async function _legacy_getAndRegisterApps (ctx: BackendContext) {

const apps = scan()
apps.forEach(app => {
const Vue = app.constructor
const Vue = _legacy_getVueFromApp(app)
registerApp({
app,
types: {},
Expand Down