-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: π don't throw only in development
Throwing changes behaviour of the code, other code may rely on this behaviour, so we either throw in all environments or console.error instead. BREAKING CHANGE: 𧨠error is logged instead of thrown in development environment
- Loading branch information
Showing
3 changed files
with
4 additions
and
4 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
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
f5faba5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does
useHoverDirty
error at all? When usinguseRef
,ref.current
is always undefined on the first render, at least in Chrome.f5faba5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this applies to the other hooks as well
f5faba5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, it expects
.current
to benull
.f5faba5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it expects
.current
to be null. Similar parameter check has been used here:react-use/src/useMouse.ts
Lines 14 to 19 in eab6c51
There are more hooks in this repo that take a ref parameter but they don't always do a parameter check. For example
useFullscreen
doesn't do anything or show a warning when no is passed in:react-use/src/useFullscreen.ts
Lines 11 to 17 in eab6c51