-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy path@radix-ui+react-use-callback-ref+1.0.1.patch
47 lines (45 loc) · 2.37 KB
/
@radix-ui+react-use-callback-ref+1.0.1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
diff --git a/node_modules/@radix-ui/react-use-callback-ref/dist/index.js b/node_modules/@radix-ui/react-use-callback-ref/dist/index.js
index 1a31eaf..79315a4 100644
--- a/node_modules/@radix-ui/react-use-callback-ref/dist/index.js
+++ b/node_modules/@radix-ui/react-use-callback-ref/dist/index.js
@@ -9,16 +9,18 @@ $parcel$export(module.exports, "useCallbackRef", () => $28e03942f763e819$export$
/**
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
* prop or avoid re-executing effects when passed as a dependency
- */ function $28e03942f763e819$export$25bec8c6f54ee79a(callback) {
- const callbackRef = $92muK$react.useRef(callback);
- $92muK$react.useEffect(()=>{
- callbackRef.current = callback;
- }); // https://github.com/facebook/react/issues/19240
- return $92muK$react.useMemo(()=>(...args)=>{
- var _callbackRef$current;
- return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
- }
- , []);
+ */
+function $28e03942f763e819$export$25bec8c6f54ee79a(callback) {
+ const callbackRef = $92muK$react.useRef(callback);
+ $92muK$react.useEffect(() => {
+ callbackRef.current = callback;
+ }); // https://github.com/facebook/react/issues/19240
+ return $92muK$react.useMemo(() => (...args) => {
+ var _callbackRef$current;
+ if (typeof (_callbackRef$current = callbackRef.current) === 'function') {
+ return _callbackRef$current.call(callbackRef, ...args);
+ }
+ }, []);
}
diff --git a/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs b/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
index 451f620..3a98d1f 100644
--- a/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
+++ b/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
@@ -11,7 +11,9 @@ import {useRef as $lwiWj$useRef, useEffect as $lwiWj$useEffect, useMemo as $lwiW
}); // https://github.com/facebook/react/issues/19240
return $lwiWj$useMemo(()=>(...args)=>{
var _callbackRef$current;
+ if (typeof (_callbackRef$current = callbackRef.current) === 'function') {
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
+ }
}
, []);
}