arttuka / reagent-material-ui

Reagent wrapper for MUI (formerly Material UI) v5
Eclipse Public License 2.0
203 stars 18 forks source link

ModalManager breaks advanced compilation when required #35

Closed 2food closed 2 years ago

2food commented 2 years ago

reagent-mui.material.modal-manager breaks advanced compilation when required. And since it's required by reagent-mui.components, requiring this ns also breaks.

After compiling with figwheel.main using advanced optimizations and bundling with webpack, it throws a runtime error saying "Component must not be nil". I couldn't find the ModalManager component in the mui source code, and the doc link in reagent-mui.material.modal-manager gives a 404 so I guess they have removed it?

Link to repo with minimal project demonstrating bug: https://github.com/2food/mui-modal-manager-bug/tree/master

arttuka commented 2 years ago

Thanks for the report. This was actually an issue with Figwheel-Main (or Clojurescript compiler) externs inference, where it failed to infer a non-default export. ModalManager just happened to be the first such export to be loaded, so that's why it was the one that showed up in the error. It is still exported in @mui/material/Modal, that wasn't actually the problem.

I changed the way non-default exports are accessed, from (.-ModalManager MuiModal) to MuiModal/ModalManager and that solved the issue. The issue is fixed in version 5.6.2-1.

2food commented 2 years ago

Ahh, I see. Thanks for the fix!