@wistia/ui 3.2.0 → 3.2.1-beta.6ecb3bb6.066b43a
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 +14 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/CHANGELOG.md +0 -2568
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v3.2.
|
|
3
|
+
* @license @wistia/ui v3.2.1-beta.6ecb3bb6.066b43a
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -1798,12 +1798,20 @@ const useWindowSize = (interval = 0) => {
|
|
|
1798
1798
|
height: isClient() ? window.innerHeight : 0
|
|
1799
1799
|
});
|
|
1800
1800
|
useLayoutEffect(() => {
|
|
1801
|
-
const
|
|
1802
|
-
width: window
|
|
1803
|
-
height:
|
|
1804
|
-
|
|
1801
|
+
const updateDimensions = () => {
|
|
1802
|
+
const { innerWidth: width, innerHeight: height } = window;
|
|
1803
|
+
setDimensions((prev) => prev.width === width && prev.height === height ? prev : {
|
|
1804
|
+
width,
|
|
1805
|
+
height
|
|
1806
|
+
});
|
|
1807
|
+
};
|
|
1808
|
+
const handleResize = debounce(interval, updateDimensions);
|
|
1809
|
+
updateDimensions();
|
|
1805
1810
|
window.addEventListener("resize", handleResize);
|
|
1806
|
-
return () =>
|
|
1811
|
+
return () => {
|
|
1812
|
+
window.removeEventListener("resize", handleResize);
|
|
1813
|
+
handleResize.cancel();
|
|
1814
|
+
};
|
|
1807
1815
|
}, [interval]);
|
|
1808
1816
|
return dimensions;
|
|
1809
1817
|
};
|