@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.js CHANGED
@@ -148,11 +148,20 @@ function responsiveTextFont(props) {
148
148
  return responsiveFont("text", props);
149
149
  }
150
150
  function useArrayProp(val, defaultVal) {
151
- const $ = reactCompilerRuntime.c(3);
151
+ const $ = reactCompilerRuntime.c(9);
152
152
  let t0;
153
153
  $[0] !== defaultVal || $[1] !== val ? (t0 = () => [_getArrayProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
154
- const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
155
- return hash !== cachedHash && setCache([_getArrayProp(val, defaultVal), hash]), cachedVal;
154
+ const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1;
155
+ let result = cachedVal, t2;
156
+ $[3] !== defaultVal || $[4] !== val ? (t2 = JSON.stringify(val ?? defaultVal), $[3] = defaultVal, $[4] = val, $[5] = t2) : t2 = $[5];
157
+ const hash = t2;
158
+ if (hash !== cachedHash) {
159
+ let t3;
160
+ $[6] !== defaultVal || $[7] !== val ? (t3 = _getArrayProp(val, defaultVal), $[6] = defaultVal, $[7] = val, $[8] = t3) : t3 = $[8];
161
+ const current = t3;
162
+ setCache([current, hash]), result = current;
163
+ }
164
+ return result;
156
165
  }
157
166
  function _getElements(element, elementsArg) {
158
167
  const ret = [element];
@@ -3529,10 +3538,11 @@ PortalProvider.displayName = "PortalProvider";
3529
3538
  const emptySubscribe = () => () => {
3530
3539
  };
3531
3540
  function useUnique(value) {
3532
- const valueRef = react.useRef(value);
3533
- return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
3541
+ const [cachedValue, setCachedValue] = react.useState(value);
3542
+ let result = cachedValue;
3543
+ return isEqual(cachedValue, value) || (setCachedValue(value), result = value), result;
3534
3544
  }
3535
- function _isEqual(objA, objB) {
3545
+ function isEqual(objA, objB) {
3536
3546
  if (!objA || !objB)
3537
3547
  return objA === objB;
3538
3548
  const keysA = Object.keys(objA), keysB = Object.keys(objB);