Skip to content

Commit 5e034fe

Browse files
committed
chore: fix positionPopover called fire-and-forget and openTimer not reset after clearing
1 parent 5d34b0e commit 5e034fe

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

app/pages/about.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@ function onMouseEnter(contributor: GitHubContributor) {
129129
if (!isExpandable(contributor)) return
130130
cancelClose()
131131
clearTimeout(openTimer.value)
132+
openTimer.value = undefined
132133
133-
const trigger = () => {
134+
const trigger = async () => {
134135
activeContributor.value = contributor
135-
positionPopover(`anchor-${contributor.id}`)
136+
await positionPopover(`anchor-${contributor.id}`)
136137
}
137138
138139
if (activeContributor.value) {
139-
trigger()
140+
void trigger()
140141
} else {
141142
openTimer.value = setTimeout(trigger, 80)
142143
}
@@ -151,12 +152,18 @@ function cancelClose() {
151152
152153
function onMouseLeave() {
153154
clearTimeout(openTimer.value)
155+
openTimer.value = undefined
154156
closeTimer.value = setTimeout(() => {
155157
const popover = document.getElementById('shared-contributor-popover')
156158
if (popover && !popover.matches(':hover')) {
157159
try {
158160
;(popover as any).hidePopover()
159-
} catch (e) {}
161+
} catch (e) {
162+
if (import.meta.dev) {
163+
// oxlint-disable-next-line no-console
164+
console.warn('[positionPopover] showPopover failed:', e)
165+
}
166+
}
160167
activeContributor.value = null
161168
}
162169
}, 120)

0 commit comments

Comments
 (0)