-
-
Notifications
You must be signed in to change notification settings - Fork 233
Fix motion popups sometimes getting stuck (#157) #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If the popup transitioned from visible to invisible before the status reached 'motion', the popup would get stuck in a visible state. This changes the code to immediately set status to 'stable' during a transition from visible to invisible if the status is something before 'motion'. Also fixes an issue where an animation frame could change the status to something invalid after a transition from visible to invisible.
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/react-component/trigger/re348m8kz |
Codecov Report
@@ Coverage Diff @@
## master #158 +/- ##
==========================================
+ Coverage 83.9% 85.42% +1.51%
==========================================
Files 7 7
Lines 466 494 +28
Branches 124 138 +14
==========================================
+ Hits 391 422 +31
+ Misses 75 72 -3
Continue to review full report at Codecov.
|
Could you pls to help create related test case on this? |
@zombieJ I've added some tests for the changes |
@@ -136,6 +143,9 @@ class Popup extends Component<PopupProps, PopupState> { | |||
const { status } = this.state; | |||
const { getRootDomNode, visible, stretch } = this.props; | |||
|
|||
// If there is a pending state update, cancel it, a new one will be set if necessary | |||
this.cancelFrameState(); |
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.
This will block status go next if parent node re-render.
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.
But the code after this line will call setStateOnNextFrame
again if necessary, so status will still get changed.
Without this, then if visible
is changed to false before the next animation frame happens, then when the frame does happen it may change the status away from stable
and cause the popup to appear when it shouldn't.
See issue #157
If the popup transitioned from visible to invisible before the status reached 'motion', the popup would get stuck in a visible state. This changes the code to immediately set status to 'stable'
during a transition from visible to invisible if the status is something before 'motion'.
Also fixes an issue where an animation frame could change the status to something invalid after a transition from visible to invisible.