Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit b8a2208

Browse files
authored
fix: unpin when actions are empty array (#157)
Fixes https://github.com/sourcegraph/sourcegraph/issues/4940
1 parent 47adbe8 commit b8a2208

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/hoverifier.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,10 @@ export function createHoverifier<C extends object, D, A>({
756756
if (!position) {
757757
return of(null)
758758
}
759-
return concat([LOADING], from(getActions(position)).pipe(catchError(error => [asError(error)]))).pipe(
759+
return concat(
760+
[LOADING],
761+
from(getActions(position)).pipe(catchError((error): [ErrorLike] => [asError(error)]))
762+
).pipe(
760763
// Do not emit anything after the code view this action came from got unhoverified
761764
takeUntil(allUnhoverifies.pipe(filter(unhoverifiedCodeViewId => unhoverifiedCodeViewId === codeViewId)))
762765
)
@@ -801,7 +804,12 @@ export function createHoverifier<C extends object, D, A>({
801804
// In the time between the click/jump and the loader being displayed,
802805
// pin the hover overlay so mouseover events get ignored
803806
// If the hover comes back empty (and the definition) it will get unpinned again
804-
Boolean(hoverOrError === undefined || (actionsOrError && !isErrorLike(actionsOrError)))
807+
Boolean(
808+
hoverOrError === undefined ||
809+
(actionsOrError &&
810+
!(Array.isArray(actionsOrError) && actionsOrError.length === 0) &&
811+
!isErrorLike(actionsOrError))
812+
)
805813
)
806814
)
807815
})

0 commit comments

Comments
 (0)