mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-28 12:36:35 +00:00
Fix bug with how we handle window size updates
This commit is contained in:
parent
bed7a84cbd
commit
83c939dd07
1 changed files with 3 additions and 4 deletions
|
|
@ -51,12 +51,11 @@ export function useScreenSize() {
|
|||
|
||||
export function useWindowSize() {
|
||||
const [size, setSize] = useState<Size>(Utils.getWindowSize());
|
||||
const handler = useCallback(
|
||||
const handler = useCallback(() => {
|
||||
Utils.throttle(() => {
|
||||
setSize(Utils.getWindowSize());
|
||||
}, 100) as () => void,
|
||||
[]
|
||||
);
|
||||
}, 100) as () => void;
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
window.addEventListener("resize", handler);
|
||||
return () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue