@rescui/use-resize-observer 0.3.4-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.10 → 0.3.4
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.
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useRef, useEffect } from 'react';
|
|
2
|
+
import { useRef, useEffect, useLayoutEffect } from 'react';
|
|
3
|
+
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
3
4
|
|
|
4
5
|
const useResizeObserver = function (target, callback) {
|
|
5
6
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
6
7
|
ignoreFirstCall: false
|
|
7
8
|
};
|
|
8
9
|
const cb = useRef(null);
|
|
9
|
-
cb.current = callback;
|
|
10
10
|
const {
|
|
11
11
|
ignoreFirstCall
|
|
12
|
-
} = options;
|
|
12
|
+
} = options; // using useLayoutEffect here so the ref has only committed to the DOM callback
|
|
13
|
+
|
|
14
|
+
useIsomorphicLayoutEffect(() => {
|
|
15
|
+
cb.current = callback;
|
|
16
|
+
}, [callback]);
|
|
13
17
|
useEffect(() => {
|
|
14
18
|
if (!target) {
|
|
15
19
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/use-resize-observer",
|
|
3
|
-
"version": "0.3.4
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "ResizeObserver hook",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"@babel/runtime-corejs3": "^7.26.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"react": ">=
|
|
22
|
+
"react": ">=16.8.0 <20"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@rescui/scripts": "0.5.2"
|
|
25
|
+
"@rescui/scripts": "^0.5.2"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "rescui-scripts build"
|
|
29
29
|
},
|
|
30
30
|
"nx": {},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "3711cbfc0c797014395421b008aa5331d6d47c6e"
|
|
32
32
|
}
|