Skip to content

Commit

Permalink
fix(sanity): ignore sticky overlay regions with a falsey DOM node (#6910
Browse files Browse the repository at this point in the history
)
  • Loading branch information
juice49 committed Jun 13, 2024
1 parent 8ed31fa commit d47e176
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/sanity/src/core/presence/overlay/StickyOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,17 @@ function regionsWithComputedRects(
regions: ReportedPresenceData[],
parent: HTMLElement,
): ReportedRegionWithRect<FieldPresenceData>[] {
return regions.map(([id, region]) => ({
...region,
id,
rect: getRelativeRect(region.element, parent),
}))
return (
regions
// Note: This filter shouldn't be necessary, but some developers have experienced regions
// being passed to the function with a `null` element.
.filter(([, region]) => Boolean(region.element))
.map(([id, region]) => ({
...region,
id,
rect: getRelativeRect(region.element, parent),
}))
)
}

type Props = {margins: Margins; children: ReactNode}
Expand Down

0 comments on commit d47e176

Please sign in to comment.