Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/AdaptivePopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ export default class AdaptivePopover extends Component<AdaptivePopoverProps, Ada
let rect: Rect;
count = 0;
do {
// Guard against ref becoming null between async iterations
if (!fromRef?.current) {
this.debug('calculateRectFromRef - ref not set, bailing');
return;
}
rect = await getRectForRef(fromRef);
if ([rect.x, rect.y, rect.width, rect.height].every(i => i === undefined)) {
this.debug('calculateRectFromRef - rect not found, all properties undefined');
Expand Down
2 changes: 1 addition & 1 deletion src/Utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function getRectForRef(ref: RefType): Promise<Rect> {
resolve(new Rect(x, y, width, height))
);
} else {
reject(new Error('getRectForRef - current is not set'));
resolve(new Rect(0, 0, 0, 0));
}
});
}
Expand Down