-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor:
useWindowSize
hook to re-render only after resize complet…
…ion (#1704) * refactor: useWindowSize hook * chore: force min-width and tweak changeset * chore: tweak changeset --------- Co-authored-by: Daniel Sinclair <d@niel.nyc>
- Loading branch information
1 parent
41616b9
commit c0a644a
Showing
5 changed files
with
27 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rainbow-me/rainbowkit": patch | ||
--- | ||
|
||
Fixed an issue that caused components to re-render on every window resize event. Now components will only re-render once the user has finished resizing their window. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export function debounce(fn: () => void, ms: number) { | ||
let timer: NodeJS.Timeout | null; | ||
|
||
return () => { | ||
if (timer) { | ||
clearTimeout(timer); | ||
} | ||
|
||
timer = setTimeout(() => { | ||
timer = null; | ||
fn(); | ||
}, ms); | ||
}; | ||
} |