export function getCurrentScopeId(): string | undefined {
const scopeOwner = getScopeOwner()
- return scopeOwner && scopeOwner.type.__scopeId
+ return scopeOwner ? scopeOwner.type.__scopeId : undefined
}
* Get the effective slot instance for accessing rawSlots and scopeId.
* Prefers currentSlotOwner (if inside a slot), falls back to currentInstance.
*/
-export function getScopeOwner(): VaporComponentInstance {
- return (currentSlotOwner || currentInstance) as VaporComponentInstance
+export function getScopeOwner(): VaporComponentInstance | null {
+ return (currentSlotOwner || currentInstance) as VaporComponentInstance | null
}
/**
const _isLastInsertion = isLastInsertion
if (!isHydrating) resetInsertionState()
- const instance = getScopeOwner()
+ const instance = getScopeOwner()!
const rawSlots = instance.rawSlots
const slotProps = rawProps
? new Proxy(rawProps, rawPropsProxyHandlers)