Skip to content

Commit

Permalink
feat: adding an effectScope to app instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Mini-ghost committed Jun 24, 2024
1 parent f8f37d9 commit a7141d4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/runtime-core/src/apiCreateApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { installAppCompatProperties } from './compat/global'
import type { NormalizedPropsOptions } from './componentProps'
import type { ObjectEmitsOptions } from './componentEmits'
import type { DefineComponent } from './apiDefineComponent'
import type { EffectScope } from '@vue/reactivity'

export interface App<HostElement = any> {
version: string
Expand Down Expand Up @@ -71,6 +72,7 @@ export interface App<HostElement = any> {
_container: HostElement | null
_context: AppContext
_instance: ComponentInternalInstance | null
_scope: EffectScope

/**
* v2 compat only
Expand Down Expand Up @@ -229,6 +231,7 @@ export function createAppAPI<HostElement>(
_container: null,
_context: context,
_instance: null,
_scope: scope,

version,

Expand Down Expand Up @@ -402,7 +405,7 @@ export function createAppAPI<HostElement>(
const lastApp = currentApp
currentApp = app
try {
return scope.run(fn)!
return app._scope.run(fn)!
} finally {
currentApp = lastApp
}
Expand Down

0 comments on commit a7141d4

Please sign in to comment.