material-components-web-react: SSR for react-button fails due to usage of HTMLElement
Hello there
SSR for @material/react-button currently fails with
if (matchesMethod in HTMLElementPrototype) {
^
TypeError: Cannot use 'in' operator to search for 'matches' in undefined
Here is a minimal reproduction of this — https://github.com/sidharthachatterjee/mdc-ssr-test
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 16 (9 by maintainers)
AH - sorry for not answer that part…I’m working on converting the components over to the new release (v1.0.0), which will fix this issue. I’m not sure how long this will take me as I have. The next 2 releases are 3/19 and 4/16. I anticipate being finished with it before 4/16, but can’t guarantee it will be done by 3/19. I know this is a popular issue so I think I could either move the 3/19 release or do another release after 3/19 – I will have to talk to the team about this one.
You can track the progress of all components being updated here: https://github.com/material-components/material-components-web-react/issues/697
@julien1619 Just want to set expectations – Next release for MDC Web is on March 4th, it’ll be out then. Thanks again for fixing this issue!
We will also then need to update MDC React’s Button component, but there are no breaking changes that I’m aware of, so this should basically just be a package.json bump.
This issue probably occurs because MDC Ripple (in MDC Web) eagerly detects which
matchesfunction to use ahead of time. We now have amatchesfunction inmdc-dom/ponyfillwhich won’t have this problem, so migrating MDC Ripple to use that function will resolve this. I’ll add an issue in MDC Web if there isn’t one already there to do this.Ah yes…I think when we merged #706 it auto-updated this issue. Thanks!
Thank you so much for the work on this one guys! I originally posted the issue in Gatsby’s repo for MDC React Components not building and now a fix is coming in March. I wish I knew enough about the root level packages and I would have contributed. Thank you again for the help, this is going to help me get a Gatsby Starter going with MDC React Components.