-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: delay handle change on one tick
- Loading branch information
Showing
5 changed files
with
28 additions
and
2 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 |
---|---|---|
|
@@ -23,3 +23,5 @@ nbbuild/ | |
dist/ | ||
nbdist/ | ||
.nb-gradle/ | ||
|
||
.vscode |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default as getUnhandledProps } from './getUnhandledProps'; | ||
export { default as tick } from './tick'; |
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,15 @@ | ||
/** Set zero timeout. | ||
* | ||
* Sometimes we need to delay rerendering components | ||
* on one tick (if they are inside `Popup` and rerendering could | ||
* change `Popup`'s content sizes). | ||
* Becouse it races with Popup's onclick handler. | ||
* `Popup` relies on it's content sizes when computing | ||
* should popup stay open or be closed. So we need | ||
* to wait until `Popup`'s onclick handler done its job. | ||
*/ | ||
const tick = (leadToRerendering, ...args) => { | ||
setTimeout(leadToRerendering, 0, ...args); | ||
}; | ||
|
||
export default tick; |