-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix <HotkeyDialog /> exit animation #221
Conversation
d3f92d2
to
9fe169e
Compare
@themadcreator can you take a look at this? want to make sure everything looks good by your eyes, since you were the author. |
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.
Some minor changes requested
public showing = false; | ||
|
||
private container: HTMLElement; | ||
private component: React.Component<any, React.ComponentState>; |
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 is saved off in render but never used AFAICT, so might as well remove it
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.
Done 👍
if (this.container == null) { | ||
this.container = this.getContainer(); | ||
} | ||
const element = this.renderComponent(); |
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.
inline this in the next line
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.
Done 👍
@themadcreator changes addressed. LMK if this looks good now. |
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 looks great, just waiting for bill. and one thing about tests that would be great to fix
@@ -114,19 +114,32 @@ describe("Hotkeys", () => { | |||
}); | |||
|
|||
it("triggers hotkey dialog with \"?\"", (done) => { | |||
// this test takes awhile. the hotkey dialog is supposed to take 100ms |
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.
ugh we really want to avoid unavoidably long tests like this, it just slows the whole thing down.
a better approach would be to assert that props are what you'd expect via the enzyme wrapper, rather than waiting for the DOM to catch up.
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 only does it slow the test suite down -- it also introduces flakiness because these timeouts are dependent on things like CPU load. I would probably prefer to skip this test until we have test-friendly minimal dialogs
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.
@cmslewis please change to it.skip(...)
to ignore this test and file an issue to track refactoring it.
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.
Filed #294
* Fix HotkeyDialog's closing transition * Edit test to not check for hiding behavior (takes too long)
PR checklist
What changes did you make?
Animate the
<HotkeyDialog>
's exit transition, per the default<Dialog />
behavior, rather than hiding the dialog immediately.Is there anything you'd like reviewers to focus on?
The DOM is getting cleared and repopulated appropriately with each call to
show()
/hide()
:But worth investigating more: are we leaking memory with each successive invocation to
ReactDOM.render
? Do we need to explicitlydelete
the old instance of the rendered element?