File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
packages/sanity/src/core/presence/overlay Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -137,11 +137,17 @@ function regionsWithComputedRects(
137
137
regions : ReportedPresenceData [ ] ,
138
138
parent : HTMLElement ,
139
139
) : ReportedRegionWithRect < FieldPresenceData > [ ] {
140
- return regions . map ( ( [ id , region ] ) => ( {
141
- ...region ,
142
- id,
143
- rect : getRelativeRect ( region . element , parent ) ,
144
- } ) )
140
+ return (
141
+ regions
142
+ // Note: This filter shouldn't be necessary, but some developers have experienced regions
143
+ // being passed to the function with a `null` element.
144
+ . filter ( ( [ , region ] ) => Boolean ( region . element ) )
145
+ . map ( ( [ id , region ] ) => ( {
146
+ ...region ,
147
+ id,
148
+ rect : getRelativeRect ( region . element , parent ) ,
149
+ } ) )
150
+ )
145
151
}
146
152
147
153
type Props = { margins : Margins ; children : ReactNode }
You can’t perform that action at this time.
0 commit comments