Skip to content

refactor: migrate @material-ui v4 → @mui/material v6#953

Merged
EightRice merged 3 commits into
masterfrom
chore/migrate-mui-v6
Jun 16, 2026
Merged

refactor: migrate @material-ui v4 → @mui/material v6#953
EightRice merged 3 commits into
masterfrom
chore/migrate-mui-v6

Conversation

@EightRice

@EightRice EightRice commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrates the entire UI layer off the long-EOL @material-ui v4 (unmaintained since Sep 2021) to @mui/material v6, removing a 4+-year-old unpatched dependency, dropping the duplicate JSS+Emotion runtime, and unblocking future React upgrades. 259 source files touched.

Done as two commits for reviewability: v4→v5 (where all the hard changes live) then v5→v6 (small).

What changed

Codemod (v4→v5 preset-safe, 285 files): import-path rewrites, icon renames, makeStyles/withStyles@mui/styles, theme wrapped in adaptV4Theme().

Manual fixes the codemod can't do:

  • Theme (theme/index.ts, legacy.ts): palette.typemode (via adaptV4Theme), MuiSelect.selectMenuselect, removed dead MuiGrid override, breakpoint module augmentation → @mui/material/styles
  • styled() prop-functions → function form + shouldForwardProp (ColorDot ×3, ProgressBar favor, StatusBadge status)
  • Dropdown: interface extends SelectProps → type intersection (SelectProps<string>)
  • components/ui barrel: withStyles re-export moved to @mui/styles
  • formik-material-ui (v4-only, abandoned) → formik-mui v5 (7 files; same component={...} API)
  • notistack 1.x (peered on @material-ui/core v4) → v3: per-variant styling moved from classes.variantX to the Components prop with styled MaterialDesignContent; container z-index via containerRoot

v5→v6: package bumps + <ListItem button><ListItemButton> (ConnectWallet). That was the only v6 type break.

Scope notes / deferrals

  • Grid stays on the legacy API — no Grid2 conversion (1,441 instances across 199 files). v6 still ships legacy Grid, so this is safe to defer to its own PR. This was the single biggest risk avoided.
  • adaptV4Theme still ships in v6 (deprecated, removed in v7). The deeply-customized v4 theme (~40 component overrides with &$checked-style pseudo-classes) keeps working through the adapter. Rewriting it to native v6 components is a follow-up before any v7 bump.
  • @mui/styles (JSS bridge) retained for the 36 makeStyles/withStyles files. Functions on v6; converting these to styled()/sx is a follow-up (also required before v7).

Test plan

  • yarn build — green
  • npx tsc --noEmit — green
  • yarn lint:check — green
  • yarn test:unit — same 2 pre-existing jsdom-env failures, no new regressions
  • Zero @material-ui / formik-material-ui references remain
  • Deploy-preview visual pass (this is where regressions hide): home/landing, explorer DAO list, DAO detail, proposal detail, creator flow (legacyTheme + formik fields), lite polls + create-proposal (formik fields), etherlink pages, and the heavy theme-override surfaces — dialogs, steppers, switches, tables, tooltips, snackbar notifications (success/error/info colors)

Removes the long-EOL @material-ui v4 packages (unmaintained since Sep
2021), consolidating on @mui/material v5 which was already partially in
use. This is the intermediate checkpoint of the v4→v6 migration; v5→v6
follows in a subsequent commit.

- Ran @mui/codemod v5.0.0/preset-safe across src (285 files): import
  path rewrites, icon renames, makeStyles/withStyles → @mui/styles,
  theme wrapped in adaptV4Theme()
- Manual fixes the codemod can't do:
  - theme: palette type→mode (via adaptV4Theme), MuiSelect selectMenu→
    select, removed dead MuiGrid align-items-xs-center override,
    breakpoint module augmentation → @mui/material/styles
  - styled() prop-function → function form + shouldForwardProp
    (ColorDot ×3, ProgressBar favor prop, StatusBadge status prop)
  - Dropdown: interface extends SelectProps → type intersection
  - components/ui barrel: withStyles re-export moved to @mui/styles
- formik-material-ui (v4-only, abandoned) → formik-mui v5 (7 files)
- notistack 1.x (peer @material-ui/core v4) → notistack v3; per-variant
  styling moved from classes.variantX to the Components prop with
  styled MaterialDesignContent; container z-index via containerRoot;
  removed codemod's stray StyledEngineProvider literal parens
- Removed @material-ui/core, @material-ui/icons, @material-ui/lab,
  formik-material-ui from package.json

Grid kept on the legacy API (no Grid2 conversion) — deferred.
yarn build, tsc --noEmit, lint:check all green. Zero @material-ui refs.
Second step of the v4→v6 migration (v5 checkpoint in the previous
commit). Most breaking changes were handled at the v4→v5 stage; v6
fallout was minimal.

- @mui/material, @mui/icons-material, @mui/styles → 6.5.0;
  @mui/lab → 6.0.1-beta.36
- ConnectWallet: <ListItem button> removed in v6 → <ListItemButton>
- Grid kept on the legacy API (Grid2 conversion deferred to a later PR)
- adaptV4Theme still ships in v6 (deprecated, removed in v7) so the
  adapted theme keeps working; @mui/styles JSS bridge still functions

yarn build, tsc --noEmit, lint:check green. Unit tests: same 2
pre-existing jsdom-env failures, no new regressions.
@netlify

netlify Bot commented Jun 13, 2026

Copy link
Copy Markdown

Deploy Preview for tezos-homebase ready!

Name Link
🔨 Latest commit 3187720
🔍 Latest deploy log https://app.netlify.com/projects/tezos-homebase/deploys/6a311b0eb2b3340008b796f9
😎 Deploy Preview https://deploy-preview-953--tezos-homebase.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 25 (🔴 down 1 from production)
Accessibility: 91 (no change from production)
Best Practices: 83 (no change from production)
SEO: 92 (no change from production)
PWA: 70 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@EightRice EightRice merged commit 134c68c into master Jun 16, 2026
5 of 6 checks passed
@EightRice EightRice deleted the chore/migrate-mui-v6 branch June 16, 2026 09:45
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.

1 participant