@sanity/ui 2.8.25 → 2.8.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.8.25",
3
+ "version": "2.8.26",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -366,7 +366,10 @@ export const Popover = memo(
366
366
  )
367
367
 
368
368
  const child = useMemo(() => {
369
- if (!childProp || referenceElement) return null
369
+ // If a reference element is defined, we don't need to clone the child
370
+ if (referenceElement) return childProp
371
+
372
+ if (!childProp) return null
370
373
 
371
374
  return cloneElement(childProp, {ref: setReference})
372
375
  }, [childProp, referenceElement, setReference])
@@ -382,9 +385,8 @@ export const Popover = memo(
382
385
  }, [update, updateRef])
383
386
 
384
387
  useEffect(() => {
385
- if (child) return
386
- refs.setReference(referenceElement || null)
387
- }, [referenceElement, refs, child])
388
+ if (referenceElement) refs.setReference(referenceElement)
389
+ }, [referenceElement, refs])
388
390
 
389
391
  if (disabled) {
390
392
  return childProp || <></>