Skip to content

Commit 88de53a

Browse files
authored
SF-3444 Prevent error when rapidly clicking Lynx panel insights (#3290)
1 parent 59d9191 commit 88de53a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/lynx-insight-overlay.service.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ export class LynxInsightOverlayService {
8888
}
8989
});
9090

91-
// When initially displayed, scroll editor if necessary to ensure overlay is displayed within editor bounds
92-
setTimeout(() => this.ensureOverlayWithinEditorBounds(overlayRef.ref));
93-
9491
this.openRef = overlayRef;
9592

93+
// When initially displayed, scroll editor if necessary to ensure overlay is displayed within editor bounds
94+
setTimeout(() => this.ensureOverlayWithinEditorBounds());
95+
9696
return overlayRef;
9797
}
9898

@@ -174,8 +174,10 @@ export class LynxInsightOverlayService {
174174
/**
175175
* Ensures the overlay is fully within the editor bounds.
176176
*/
177-
private ensureOverlayWithinEditorBounds(overlayRef: OverlayRef): void {
178-
if (this.scrollableContainer == null) {
177+
private ensureOverlayWithinEditorBounds(): void {
178+
const overlayRef: OverlayRef | undefined = this.openRef?.ref;
179+
180+
if (this.scrollableContainer == null || overlayRef?.overlayElement == null) {
179181
return;
180182
}
181183

0 commit comments

Comments
 (0)