refactor: tweaks
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
||||
} from '@vue/shared'
|
||||
import { SuspenseBoundary } from './components/Suspense'
|
||||
import { CompilerError, CompilerOptions } from '@vue/compiler-core'
|
||||
import { currentRenderingInstance } from './componentRenderUtils'
|
||||
|
||||
export type Data = { [key: string]: unknown }
|
||||
|
||||
@@ -112,6 +113,7 @@ export interface ComponentInternalInstance {
|
||||
sink: { [key: string]: any }
|
||||
|
||||
// lifecycle
|
||||
isMounted: boolean
|
||||
isUnmounted: boolean
|
||||
isDeactivated: boolean
|
||||
[LifecycleHooks.BEFORE_CREATE]: LifecycleHook
|
||||
@@ -179,6 +181,7 @@ export function createComponentInstance(
|
||||
|
||||
// lifecycle hooks
|
||||
// not using enums here because it results in computed properties
|
||||
isMounted: false,
|
||||
isUnmounted: false,
|
||||
isDeactivated: false,
|
||||
bc: null,
|
||||
@@ -217,7 +220,7 @@ export let currentInstance: ComponentInternalInstance | null = null
|
||||
export let currentSuspense: SuspenseBoundary | null = null
|
||||
|
||||
export const getCurrentInstance: () => ComponentInternalInstance | null = () =>
|
||||
currentInstance
|
||||
currentInstance || currentRenderingInstance
|
||||
|
||||
export const setCurrentInstance = (
|
||||
instance: ComponentInternalInstance | null
|
||||
|
||||
Reference in New Issue
Block a user