Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update react v18, mui v5 #690

Merged
merged 2 commits into from Jul 15, 2022
Merged

chore: update react v18, mui v5 #690

merged 2 commits into from Jul 15, 2022

Conversation

pviotti
Copy link
Member

@pviotti pviotti commented Jul 15, 2022

I have recently migrated to React v18 another project, and it's been painless so I thought it'd be the same for this one - oh boy, was I wrong. There's a few additional changes to make it work, due to some incompatibilities, APIs deprecation, introduction of new NPM packages, etc - a classic javascript version bump 馃槄

Basically:

  • as you see in fix(deps): update react monorepo to v18 (major)聽#667 (comment) react v18 doesn't work with current version of Material UI
  • the new major version of Material UI (5.x), changed package name (it's @mui/* now) and also changed the way it deals with themes and styles, so:
    • 2 new npm packages are needed (@emotion/react and @emotion/styled)
    • makeStyles and similar functions are not supported anymore - or, more precisely, they still work as a legacy feature, but not with react v18: you'd need to use @mui/styles, except
      @mui/styles is not compatible with React.StrictMode or React 18.
      
      so I had to remove all the custom theming stuff and move the injected custom style to a separate CSS, imported once in index.js.

I hope it makes sense (as much as it can..).
CSS is not exactly as before, and sometimes the MUI theme is prevailing (that's why I tried putting !important on some rules), but that can be fixed later I guess.

馃憢

Other references:

close #681

@github-actions github-actions bot temporarily deployed to 690 July 15, 2022 08:07 Destroyed
@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2022

Codecov Report

Merging #690 (a832bc5) into master (77cbc25) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #690   +/-   ##
=========================================
  Coverage     51.14%   51.14%           
  Complexity     1447     1447           
=========================================
  Files           249      249           
  Lines          9879     9879           
  Branches       1092     1092           
=========================================
  Hits           5053     5053           
  Misses         4507     4507           
  Partials        319      319           

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 77cbc25...a832bc5. Read the comment docs.

@github-actions github-actions bot temporarily deployed to 690 July 15, 2022 08:08 Destroyed
@pviotti pviotti requested a review from lupino3 July 15, 2022 08:14
@lupino3
Copy link
Member

lupino3 commented Jul 15, 2022

Hey Paolo! 馃憢馃徏
Thanks a lot for the update! As you've seen, I attempted the update but failed miserably 馃槅

I understand the additions of !important (that also trigger Codacity), and they make total sense to me. Your changes preserve the functionality and UX while updating the dependencies, and that's perfect for me.

Thanks again for your contributions! Merging the PR as-is. :shipit:

@lupino3 lupino3 merged commit 23ebd04 into master Jul 15, 2022
@lupino3 lupino3 deleted the chore/react-18 branch July 15, 2022 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to React 18
3 participants