|
|
@@ -1,10 +1,4 @@
|
|
|
-import {
|
|
|
- EffectScope,
|
|
|
- type Ref,
|
|
|
- pauseTracking,
|
|
|
- ref,
|
|
|
- resetTracking,
|
|
|
-} from '@vue/reactivity'
|
|
|
+import { EffectScope } from '@vue/reactivity'
|
|
|
|
|
|
import { EMPTY_OBJ } from '@vue/shared'
|
|
|
import type { Block } from './render'
|
|
|
@@ -51,11 +45,9 @@ export interface ComponentInternalInstance {
|
|
|
dirs: Map<Node, DirectiveBinding[]>
|
|
|
|
|
|
// lifecycle
|
|
|
- get isMounted(): boolean
|
|
|
- get isUnmounted(): boolean
|
|
|
+ isMounted: boolean
|
|
|
+ isUnmounted: boolean
|
|
|
isUpdating: boolean
|
|
|
- isUnmountedRef: Ref<boolean>
|
|
|
- isMountedRef: Ref<boolean>
|
|
|
// TODO: registory of provides, lifecycles, ...
|
|
|
/**
|
|
|
* @internal
|
|
|
@@ -140,8 +132,6 @@ let uid = 0
|
|
|
export const createComponentInstance = (
|
|
|
component: ObjectComponent | FunctionalComponent,
|
|
|
): ComponentInternalInstance => {
|
|
|
- const isMountedRef = ref(false)
|
|
|
- const isUnmountedRef = ref(false)
|
|
|
const instance: ComponentInternalInstance = {
|
|
|
uid: uid++,
|
|
|
block: null,
|
|
|
@@ -163,21 +153,9 @@ export const createComponentInstance = (
|
|
|
dirs: new Map(),
|
|
|
|
|
|
// lifecycle
|
|
|
- get isMounted() {
|
|
|
- pauseTracking()
|
|
|
- const value = isMountedRef.value
|
|
|
- resetTracking()
|
|
|
- return value
|
|
|
- },
|
|
|
- get isUnmounted() {
|
|
|
- pauseTracking()
|
|
|
- const value = isUnmountedRef.value
|
|
|
- resetTracking()
|
|
|
- return value
|
|
|
- },
|
|
|
+ isMounted: false,
|
|
|
+ isUnmounted: false,
|
|
|
isUpdating: false,
|
|
|
- isMountedRef,
|
|
|
- isUnmountedRef,
|
|
|
// TODO: registory of provides, appContext, lifecycles, ...
|
|
|
/**
|
|
|
* @internal
|