@react-aria/utils
Advanced tools
Comparing version 3.8.1 to 3.8.2
@@ -46,3 +46,4 @@ var { | ||
let [value, setValue] = useState(defaultId); | ||
let nextId = useRef(null); // don't memo this, we want it new each render so that the Effects always run | ||
let nextId = useRef(null); | ||
let res = useSSRSafeId(value); // don't memo this, we want it new each render so that the Effects always run | ||
@@ -57,5 +58,12 @@ let updateValue = val => { | ||
$f09fcd7f5f367fc80aacfeac62ed2$var$idsUpdaterMap.set(res, updateValue); | ||
useLayoutEffect(() => { | ||
isRendering.current = false; | ||
}, [updateValue]); | ||
useLayoutEffect(() => { | ||
let r = res; | ||
return () => { | ||
$f09fcd7f5f367fc80aacfeac62ed2$var$idsUpdaterMap.delete(r); | ||
}; | ||
}, [res]); | ||
useEffect(() => { | ||
@@ -69,4 +77,2 @@ let newId = nextId.current; | ||
}, [setValue, updateValue]); | ||
let res = useSSRSafeId(value); | ||
$f09fcd7f5f367fc80aacfeac62ed2$var$idsUpdaterMap.set(res, updateValue); | ||
return res; | ||
@@ -112,3 +118,4 @@ } | ||
function useSlotId() { | ||
let [id, setId] = useState(useId()); | ||
let id = useId(); | ||
let [resolvedId, setResolvedId] = useState(id); | ||
useLayoutEffect(() => { | ||
@@ -118,6 +125,8 @@ let setCurr = $f09fcd7f5f367fc80aacfeac62ed2$var$idsUpdaterMap.get(id); | ||
if (setCurr && !document.getElementById(id)) { | ||
setId(null); | ||
setResolvedId(null); | ||
} else { | ||
setResolvedId(id); | ||
} | ||
}, [id]); | ||
return id; | ||
return resolvedId; | ||
} | ||
@@ -203,7 +212,2 @@ | ||
const $a736ffc3e05a0bfc1508098ba395b41$var$propRe = /^(data-.*)$/; | ||
/** | ||
* Filters out all props that aren't valid DOM props or defined via override prop obj. | ||
* @param props - The component props to be filtered. | ||
* @param opts - Props to override. | ||
*/ | ||
@@ -210,0 +214,0 @@ function filterDOMProps(props, opts) { |
@@ -20,3 +20,4 @@ import { clamp, snapValueToStep } from "@react-stately/utils"; | ||
let [value, setValue] = useState(defaultId); | ||
let nextId = useRef(null); // don't memo this, we want it new each render so that the Effects always run | ||
let nextId = useRef(null); | ||
let res = useSSRSafeId(value); // don't memo this, we want it new each render so that the Effects always run | ||
@@ -31,5 +32,12 @@ let updateValue = val => { | ||
$f8b5fdd96fb429d7102983f777c41307$var$idsUpdaterMap.set(res, updateValue); | ||
useLayoutEffect(() => { | ||
isRendering.current = false; | ||
}, [updateValue]); | ||
useLayoutEffect(() => { | ||
let r = res; | ||
return () => { | ||
$f8b5fdd96fb429d7102983f777c41307$var$idsUpdaterMap.delete(r); | ||
}; | ||
}, [res]); | ||
useEffect(() => { | ||
@@ -43,4 +51,2 @@ let newId = nextId.current; | ||
}, [setValue, updateValue]); | ||
let res = useSSRSafeId(value); | ||
$f8b5fdd96fb429d7102983f777c41307$var$idsUpdaterMap.set(res, updateValue); | ||
return res; | ||
@@ -80,3 +86,4 @@ } | ||
export function useSlotId() { | ||
let [id, setId] = useState(useId()); | ||
let id = useId(); | ||
let [resolvedId, setResolvedId] = useState(id); | ||
useLayoutEffect(() => { | ||
@@ -86,6 +93,8 @@ let setCurr = $f8b5fdd96fb429d7102983f777c41307$var$idsUpdaterMap.get(id); | ||
if (setCurr && !document.getElementById(id)) { | ||
setId(null); | ||
setResolvedId(null); | ||
} else { | ||
setResolvedId(id); | ||
} | ||
}, [id]); | ||
return id; | ||
return resolvedId; | ||
} | ||
@@ -165,8 +174,2 @@ | ||
const $f6a965352cabf1a7c37e8c1337e5eab$var$propRe = /^(data-.*)$/; | ||
/** | ||
* Filters out all props that aren't valid DOM props or defined via override prop obj. | ||
* @param props - The component props to be filtered. | ||
* @param opts - Props to override. | ||
*/ | ||
export function filterDOMProps(props, opts) { | ||
@@ -173,0 +176,0 @@ if (opts === void 0) { |
{ | ||
"name": "@react-aria/utils", | ||
"version": "3.8.1", | ||
"version": "3.8.2", | ||
"description": "Spectrum UI components in React", | ||
@@ -21,5 +21,5 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/ssr": "^3.0.2", | ||
"@react-stately/utils": "^3.2.1", | ||
"@react-types/shared": "^3.7.0", | ||
"@react-aria/ssr": "^3.0.3", | ||
"@react-stately/utils": "^3.2.2", | ||
"@react-types/shared": "^3.8.0", | ||
"clsx": "^1.1.1" | ||
@@ -33,3 +33,3 @@ }, | ||
}, | ||
"gitHead": "83b70255d97b3068988f8972e9c9a39a7352926e" | ||
"gitHead": "9204e1b8cb61dac767e91087fb16203611dc67c5" | ||
} |
@@ -28,2 +28,5 @@ /* | ||
let nextId = useRef(null); | ||
let res = useSSRSafeId(value); | ||
// don't memo this, we want it new each render so that the Effects always run | ||
@@ -38,2 +41,4 @@ let updateValue = (val) => { | ||
idsUpdaterMap.set(res, updateValue); | ||
useLayoutEffect(() => { | ||
@@ -43,2 +48,9 @@ isRendering.current = false; | ||
useLayoutEffect(() => { | ||
let r = res; | ||
return () => { | ||
idsUpdaterMap.delete(r); | ||
}; | ||
}, [res]); | ||
useEffect(() => { | ||
@@ -51,5 +63,2 @@ let newId = nextId.current; | ||
}, [setValue, updateValue]); | ||
let res = useSSRSafeId(value); | ||
idsUpdaterMap.set(res, updateValue); | ||
return res; | ||
@@ -87,11 +96,14 @@ } | ||
export function useSlotId(): string { | ||
let [id, setId] = useState(useId()); | ||
let id = useId(); | ||
let [resolvedId, setResolvedId] = useState(id); | ||
useLayoutEffect(() => { | ||
let setCurr = idsUpdaterMap.get(id); | ||
if (setCurr && !document.getElementById(id)) { | ||
setId(null); | ||
setResolvedId(null); | ||
} else { | ||
setResolvedId(id); | ||
} | ||
}, [id]); | ||
return id; | ||
return resolvedId; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
238000
2535
Updated@react-aria/ssr@^3.0.3
Updated@react-stately/utils@^3.2.2
Updated@react-types/shared@^3.8.0