File tree Expand file tree Collapse file tree
packages/0/src/components/Tooltip Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 import { useTooltip } from ' #v0/composables/useTooltip'
2222
2323 // Utilities
24+ import { isUndefined } from ' #v0/utilities'
2425 import { onBeforeUnmount , shallowRef , toRef , watch } from ' vue'
2526
2627 // Types
9192 const isDisabled = toRef (() => disabled || region .disabled .value )
9293 const isInteractive = toRef (() => interactive )
9394
94- const isOpen: Ref <boolean > = model .value === undefined
95+ const isOpen: Ref <boolean > = isUndefined ( model .value )
9596 ? shallowRef (defaultOpen )
9697 : (model as Ref <boolean >)
9798
130131 let ticketId: ID | undefined
131132
132133 watch (isOpen , value => {
133- if (value && ticketId === undefined ) {
134+ if (value && isUndefined ( ticketId ) ) {
134135 const ticket = region .register ({ id: popover .id })
135136 ticketId = ticket .id
136- } else if (! value && ticketId !== undefined ) {
137+ } else if (! value && ! isUndefined ( ticketId ) ) {
137138 region .unregister (ticketId )
138139 ticketId = undefined
139140 }
140141 }, { immediate: true })
141142
142143 onBeforeUnmount (() => {
143- if (ticketId !== undefined ) region .unregister (ticketId )
144+ if (! isUndefined ( ticketId ) ) region .unregister (ticketId )
144145 })
145146
146147 const dataState = toRef ((): ' open' | ' closed' | ' delayed-open' | ' instant-open' => {
You can’t perform that action at this time.
0 commit comments