-
Notifications
You must be signed in to change notification settings - Fork 227
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(menu-surface): Hoist menu-surface via a portal (#500,#628) #693
Conversation
Codecov Report
@@ Coverage Diff @@
## rc0.11.0 #693 +/- ##
============================================
- Coverage 94.8% 94.79% -0.02%
============================================
Files 73 73
Lines 2928 2922 -6
Branches 448 446 -2
============================================
- Hits 2776 2770 -6
Misses 50 50
Partials 102 102
Continue to review full report at Codecov.
|
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.
Changes look good overall. Just some small clean up
I've added a fix for the SSR issue but I'm wondering if it would be better to follow the suggestion here facebook/react#13097 (comment) let me know what you think and I can update the PR if needed. |
I ran |
It was working locally but I must have missed something. I'll look into it. |
Not sure what is up with the build and why the button screenshot tests keep timing out but seems to be unrelated to my changes as far as I can tell. I have fixed the issue with the menu-surface being open for the initial render. |
@ben-mckernan button screenshot sometimes does that...it is because there isn't enough time for the webpack-dev-server to start up. Just need to restart the build. |
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.
Looks good!
Do you need me to squash the commits or will you do it when merging? |
Yes please squash. However the tests are failing...it looks like button, which is something you didn't touch. Also I ran them locally and they pass. Can you update the
|
packages/menu-surface/package.json
Outdated
@@ -19,7 +19,8 @@ | |||
"dependencies": { | |||
"@material/menu-surface": "^0.41.0", | |||
"classnames": "^2.2.5", | |||
"react": "^16.4.2" | |||
"react": "^16.4.2", | |||
"react-dom": "16.4.2" |
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.
@ben-mckernan can you also add the ^
to react-dom please?
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.
Yes, of course. Good catch!
Changing the sleep didn't help. But from the build log it looks like the
|
Hmm not sure if it is the timeout, because its only the first test. This leads me to believe that the startup is not complete. Also the tests all complete within 3s - 10s. If you look here you can see the times for each test to complete. I'm going to restart the test and see if that fixes it. |
Try increasing the |
Can't believe that didn't work...Trying out what you suggested |
@ben-mckernan not sure what's going on. try increasing the timeout for pupeteer in |
I'm wondering if this has something to do with adding react-dom package. That's the only thing I can think of that would slow this down compared to the other PRs that are out. |
Increasing The webpack build for the screenshot tests already includes react-dom in its entry point so just adding react-dom shouldn't affect them, however the addition of I don't know enough about how puppeteer works but I would speculate that this threshold would have eventually been reached regardless as new features or tests are added that increase the size of the bundle produced by the screenshot build. So something that might be worth testing is minifying the screenshot bundle to see if that affects the initial page load time. But your point about react-dom did make me realize that it is not marked as external for the standard build and so it was being bundled with menu-surface. I have added a fix for this. |
@ben-mckernan oh man! Thanks for putting that in there (externals). That would have been a huge bundle increase...Anyways, what you last wrote made sense and I agree with it. Sorry this took so long, and I hope it doesn't deter you from contributing again. Thanks so much. |
Use
ReactDOM.createPortal
when hoisting the menu surface so that react can handle mounting and unmounting.