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 authored Jun 13, 2024
1 parent 911ebfd commit 4f1be6c
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

1 comment on commit 4f1be6c

@ahmedrowaihi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's necessary, when you use custom structure it bugs
thank you so much, I can remove my patch now! issues/6949

Please sign in to comment.