@sanity/ui 3.0.12 → 3.0.13

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": "3.0.12",
3
+ "version": "3.0.13",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -122,11 +122,13 @@ export function MenuGroup(
122
122
 
123
123
  // Close child menu when a sibling item becomes active
124
124
  useEffect(() => {
125
+ // eslint-disable-next-line react-hooks/set-state-in-effect
125
126
  if (!active) setOpen(false)
126
127
  }, [active])
127
128
 
128
129
  // Update state when child menu is no longer open
129
130
  useEffect(() => {
131
+ // eslint-disable-next-line react-hooks/set-state-in-effect
130
132
  if (!open) setWithinMenu(false)
131
133
  }, [open])
132
134
 
@@ -32,7 +32,7 @@ export const Skeleton = forwardRef(function Skeleton(
32
32
 
33
33
  useEffect(() => {
34
34
  if (!delay) {
35
- return setVisible(true)
35
+ return undefined
36
36
  }
37
37
 
38
38
  const timeout = setTimeout(() => {
@@ -49,7 +49,7 @@ export const Skeleton = forwardRef(function Skeleton(
49
49
  {...restProps}
50
50
  $animated={animated}
51
51
  $radius={useArrayProp(radius)}
52
- $visible={visible}
52
+ $visible={delay ? visible : true}
53
53
  ref={ref}
54
54
  />
55
55
  )
@@ -208,6 +208,7 @@ export const Tree = forwardRef(function Tree(
208
208
  ref.current.querySelectorAll('[data-ui="TreeItem"]'),
209
209
  ) as HTMLElement[]
210
210
 
211
+ // eslint-disable-next-line react-hooks/set-state-in-effect
211
212
  setItemElements(_itemElements)
212
213
  }, [children])
213
214
 
@@ -58,6 +58,7 @@ export function useClickOutside(
58
58
  const nextElements = _getElements(element, elementsArg)
59
59
 
60
60
  if (prevElements.length !== nextElements.length) {
61
+ // eslint-disable-next-line react-hooks/set-state-in-effect
61
62
  setElements(nextElements)
62
63
  elementsRef.current = nextElements
63
64
 
@@ -102,6 +102,7 @@ export const Avatar = forwardRef(function Avatar(
102
102
  }, [arrowPosition, arrowPositionProp])
103
103
 
104
104
  useEffect(() => {
105
+ // eslint-disable-next-line react-hooks/set-state-in-effect
105
106
  if (src) setImageFailed(false)
106
107
  }, [src])
107
108
 
@@ -285,6 +285,7 @@ export const Tooltip = forwardRef(function Tooltip(
285
285
  portalElement?.offsetWidth || document.body.offsetWidth,
286
286
  ]
287
287
 
288
+ // eslint-disable-next-line react-hooks/set-state-in-effect
288
289
  setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2)
289
290
  }, [boundaryElement, portalElement])
290
291
 
@@ -66,6 +66,7 @@ export const VirtualList = forwardRef(function VirtualList(
66
66
  const firstElement = wrapperRef.current.firstChild
67
67
 
68
68
  if (firstElement instanceof HTMLElement) {
69
+ // eslint-disable-next-line react-hooks/set-state-in-effect
69
70
  setItemHeight(firstElement.offsetHeight)
70
71
  }
71
72
  }, [renderItem])
@@ -111,6 +112,7 @@ export const VirtualList = forwardRef(function VirtualList(
111
112
  window.addEventListener('scroll', handleScroll, {passive: true})
112
113
  window.addEventListener('resize', handleResize)
113
114
 
115
+ // eslint-disable-next-line react-hooks/set-state-in-effect
114
116
  setScrollHeight(window.innerHeight)
115
117
 
116
118
  handleScroll()