File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,25 @@ export let currentInstance: GenericComponentInstance | null = null
16
16
export const getCurrentGenericInstance : ( ) => GenericComponentInstance | null =
17
17
( ) => currentInstance || currentRenderingInstance
18
18
19
- export const getCurrentInstance : ( ) => ComponentInternalInstance | null = ( ) =>
20
- currentInstance && ! currentInstance . vapor
21
- ? ( currentInstance as ComponentInternalInstance )
19
+ /**
20
+ * Retrieves the current component instance.
21
+ *
22
+ * @param generic - A boolean flag indicating whether to return a generic component instance.
23
+ * If `true`, returns a `GenericComponentInstance` including vapor instance.
24
+ * If `false` or unset, returns a `ComponentInternalInstance` if available.
25
+ * @returns The current component instance, or `null` if no instance is active.
26
+ */
27
+ export function getCurrentInstance (
28
+ generic : true ,
29
+ ) : GenericComponentInstance | null
30
+ export function getCurrentInstance (
31
+ generic ?: boolean ,
32
+ ) : ComponentInternalInstance | null
33
+ export function getCurrentInstance ( generic ?: boolean ) {
34
+ return currentInstance && ( generic || ! currentInstance . vapor )
35
+ ? currentInstance
22
36
: currentRenderingInstance
37
+ }
23
38
24
39
export let isInSSRComponentSetup = false
25
40
You can’t perform that action at this time.
0 commit comments