-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite useImperativeHandle to use useLayoutEffect (-35 B) (#2003)
* Rewrite useImperativeHandle to use useLayoutEffect (-41 B) * Add new useContext test * Rerun imperative handler creator if ref changes (+3 B) * Improve hooks JSDoc * Assign the return value of push to _afterPaintQueued (-2 B) * Consistenly assign a number to _afterPaintQueued (-1 B) * Support no deps array in useImperativeHandle (+12 B) * Rename `safeRaf` to `afterNextFrame` ...since its implementation does more than a real `safeRaf` implementation. In other words, `safeRaf` invokes the callback after a rAF (or timeout) and another timeout (line 241) so its not a pure `safeRaf`. So to avoid confustion, I renamed the function to be clearer and added a comment describing its purpose * Reuse `prevRaf` variable (-4 B)
- Loading branch information
1 parent
48bd8b5
commit 0aeca9a
Showing
4 changed files
with
170 additions
and
27 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
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