@sanity/ui 2.8.23 → 2.8.24-canary.0

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/dist/index.esm.js CHANGED
@@ -154,11 +154,20 @@ function responsiveTextFont(props) {
154
154
  return responsiveFont("text", props);
155
155
  }
156
156
  function useArrayProp(val, defaultVal) {
157
- const $ = c(3);
157
+ const $ = c(9);
158
158
  let t0;
159
159
  $[0] !== defaultVal || $[1] !== val ? (t0 = () => [_getArrayProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
160
- const [t1, setCache] = useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
161
- return hash !== cachedHash && setCache([_getArrayProp(val, defaultVal), hash]), cachedVal;
160
+ const [t1, setCache] = useState(t0), [cachedVal, cachedHash] = t1;
161
+ let result = cachedVal, t2;
162
+ $[3] !== defaultVal || $[4] !== val ? (t2 = JSON.stringify(val ?? defaultVal), $[3] = defaultVal, $[4] = val, $[5] = t2) : t2 = $[5];
163
+ const hash = t2;
164
+ if (hash !== cachedHash) {
165
+ let t3;
166
+ $[6] !== defaultVal || $[7] !== val ? (t3 = _getArrayProp(val, defaultVal), $[6] = defaultVal, $[7] = val, $[8] = t3) : t3 = $[8];
167
+ const current = t3;
168
+ setCache([current, hash]), result = current;
169
+ }
170
+ return result;
162
171
  }
163
172
  function _getElements(element, elementsArg) {
164
173
  const ret = [element];
@@ -3535,10 +3544,11 @@ PortalProvider.displayName = "PortalProvider";
3535
3544
  const emptySubscribe = () => () => {
3536
3545
  };
3537
3546
  function useUnique(value) {
3538
- const valueRef = useRef(value);
3539
- return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
3547
+ const [cachedValue, setCachedValue] = useState(value);
3548
+ let result = cachedValue;
3549
+ return isEqual(cachedValue, value) || (setCachedValue(value), result = value), result;
3540
3550
  }
3541
- function _isEqual(objA, objB) {
3551
+ function isEqual(objA, objB) {
3542
3552
  if (!objA || !objB)
3543
3553
  return objA === objB;
3544
3554
  const keysA = Object.keys(objA), keysB = Object.keys(objB);