-
-
Notifications
You must be signed in to change notification settings - Fork 32
Upgrade mui to v 7 #2271
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
Merged
Merged
Upgrade mui to v 7 #2271
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d145861
solved pre-commit issue
fateme-ramezanpour 8297fcd
comment pre-commit code that came from master
fateme-ramezanpour 301cc32
upgrade mui v to 7
fateme-ramezanpour 2229407
bting back pre-commit code
fateme-ramezanpour 45406d9
fix test error
fateme-ramezanpour 5b58d9e
added StylesThemeProvider to the test
fateme-ramezanpour bdff0f7
Merge remote-tracking branch 'origin/master' into upgrade-mui-to-v-7
Copilot a083f3f
fixed test problem with MUI
fateme-ramezanpour 58c2fc4
Merge branch 'master' into upgrade-mui-to-v-7
fateme-ramezanpour 7f67ecb
Merge branch 'master' into upgrade-mui-to-v-7
HaraldWalker 19059b6
addressed PR comments
fateme-ramezanpour 3378bba
Merge branch 'upgrade-mui-to-v-7' of https://github.com/climateconnec…
fateme-ramezanpour File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| # Frontend: Upgrade MUI from v6.x to v7.x | ||
|
|
||
| ## Problem Statement | ||
|
|
||
| The frontend currently depends on Material UI v6 (`@mui/material` at `^6.5.0` plus related MUI packages). The project is now on a newer toolchain baseline (Next.js 15, React 19, TypeScript 5.x), and the product has already started consuming MUI v7-compatible packages in a few areas. We need to complete the upgrade to MUI 7.x to stay aligned with the active upstream support window, avoid technical debt, and reduce the risk of future incompatibilities with the rest of the frontend stack. | ||
|
|
||
| The upgrade should be treated as a compatibility migration, not a redesign. We need to adopt the v7 API and behavior without changing user-visible functionality, while keeping the app stable across SSR, pages, and shared UI components. | ||
|
|
||
| ## Related issue | ||
|
|
||
| - GitHub issue: #2241 | ||
| - Official migration guide: https://v7.mui.com/material-ui/migration/upgrade-to-v7/ | ||
|
|
||
| ## Scope | ||
|
|
||
| ### In scope | ||
|
|
||
| - Upgrading the frontend MUI dependencies to v7.x. | ||
| - Updating any code that is incompatible with MUI v7 defaults or deprecations. | ||
| - Resolving theme, styling, and component API differences introduced by the upgrade. | ||
| - Verifying that all frontend linting, type checking, and tests still pass. | ||
| - Ensuring pages, forms, navigation, dialogs, and layout components keep their current behavior. | ||
|
|
||
| ### Out of scope | ||
|
|
||
| - Redesigning the UI or product flows. | ||
| - Rewriting large portions of the frontend unrelated to MUI compatibility. | ||
| - Backend work or any data model changes. | ||
| - General React/Next.js modernization beyond what is required to support MUI 7. | ||
|
|
||
| ## Background and Root Cause | ||
|
|
||
| This upgrade is required because the app is pinned to a MUI v6 stack while the ecosystem and other frontend dependencies have moved forward. The risk is not just dependency drift: MUI 7 introduces breaking changes in API usage, styling assumptions, and some slot and theming patterns. If the upgrade is done without a disciplined migration pass, the app will likely fail in compile-time or runtime because of deprecated patterns and changed defaults. | ||
|
|
||
| This issue should follow the official MUI V7 migration guidance and adapt only the parts of the app that are incompatible with that major change. The goal is to land a working upgrade that preserves the same UX while removing v6-era compatibility constraints. | ||
|
|
||
| ## Proposed Solution | ||
|
|
||
| 1. Upgrade the MUI packages used by the frontend to the v7-compatible release line. | ||
| 2. Audit the app for usage patterns that are known to break or deprecate in v7. | ||
| 3. Update theme setup, styled components, and custom wrappers to the v7-compatible patterns. | ||
| 4. Remove or replace any legacy v6-only usage that is not supported in v7. | ||
| 5. Run the repo’s frontend validation commands and fix any regressions. | ||
|
|
||
| ## Detailed Requirements | ||
|
|
||
| ### Dependency upgrade | ||
|
|
||
| - Update the MUI packages in `frontend/package.json` to v7.x versions. | ||
| - Ensure the full set of MUI libraries used by the project remains internally consistent: | ||
| - `@mui/material` | ||
| - `@mui/icons-material` | ||
| - `@mui/x-data-grid` | ||
| - `@mui/x-date-pickers` | ||
| - any other MUI packages imported by the app | ||
| - Validate whether `@mui/styles` is still required. If it is not necessary for the app, remove it or replace its usage with emotion-based styling as appropriate. | ||
|
|
||
| ### Compatibility pass | ||
|
|
||
| The migration should include a targeted review of: | ||
|
|
||
| - Theme overrides and custom `createTheme` usage. | ||
| - Styled components built with `styled(...)` and emotion wrappers. | ||
| - Components using old MUI slot APIs or deprecated props. | ||
| - Components reading theme or palette values via patterns no longer recommended in v7. | ||
| - Cases where `Grid` or layout helpers rely on v6 assumptions. | ||
| - Components or helpers that pass `className`, `sx`, `slotProps`, `slot` values, or `components` overrides in ways that changed in v7. | ||
|
|
||
| The migration should prefer the current official v7 patterns over maintaining a compatibility layer unless the compatibility layer is necessary to avoid a broad refactor. | ||
|
|
||
| ### Implementation constraints | ||
|
|
||
| - This is a frontend-only change. | ||
| - No backend API contract changes are allowed. | ||
| - No product requirements or design changes should be bundled into the MUI upgrade. | ||
| - Existing URLs, routes, and user flows must remain unchanged. | ||
| - The upgrade should not break SSR or client rendering behavior. | ||
|
|
||
| ## Acceptance Criteria | ||
|
|
||
| ### Functional / build criteria | ||
|
|
||
| - [ ] The frontend dependencies are upgraded to MUI v7.x in `frontend/package.json`. | ||
| - [ ] The app builds successfully with the upgraded dependency set. | ||
| - [ ] Type checking and linting pass after the migration. | ||
| - [ ] Existing frontend tests pass or are updated only where required by v7 compatibility. | ||
| - [ ] No user-facing behavior regressions are introduced by the upgrade. | ||
|
|
||
| ### Code compatibility criteria | ||
|
|
||
| - [ ] All code that relies on MUI v6 behavior is reviewed and updated to v7-compatible patterns. | ||
| - [ ] Deprecated or removed MUI API usage is replaced with supported v7 equivalents. | ||
| - [ ] Theme configuration remains valid under MUI v7. | ||
| - [ ] Any legacy usage of `@mui/styles` is removed or reduced to a non-breaking migration path. | ||
| - [ ] Custom wrappers and shared components continue to render and behave correctly. | ||
|
|
||
| ### Regression prevention criteria | ||
|
|
||
| - [ ] The app still renders correctly in common pages, forms, dialogs, and navigation flows. | ||
| - [ ] No crash occurs during SSR or hydration due to theme or component incompatibility. | ||
| - [ ] Layout and visual styling remain acceptable after the upgrade. | ||
| - [ ] No unreachable or hidden runtime errors are introduced in the UI by a v7 API change. | ||
|
|
||
| ## Validation Plan | ||
|
|
||
| The following checks must be run before the change is considered complete: | ||
|
|
||
| 1. `cd frontend && yarn install` (or equivalent lockfile update if needed) | ||
| 2. `cd frontend && yarn lint` | ||
| 3. `cd frontend && yarn check-types` | ||
| 4. `cd frontend && yarn test` (or the project’s relevant frontend test target) | ||
| 5. `cd frontend && yarn build` | ||
|
|
||
| If the project has additional page-level smoke checks, those should be run as part of the migration validation, particularly around shared layout and any frequently used MUI components. | ||
|
|
||
| ## Risks and Considerations | ||
|
|
||
| ### Hidden compatibility issues | ||
|
|
||
| Some breakage may not appear in unit tests because it will only show up in hydrated pages or in specific UI edge cases. We should therefore prioritize app-wide validation of shared UI components and layouts, not just isolated component tests. | ||
|
|
||
| ### Theme and styling drift | ||
|
|
||
| MUI 7 may change theme semantics or default styling behavior. Custom theme overrides need to be reviewed carefully so that color, spacing, shadows, typography, and component variants remain visually consistent. | ||
|
|
||
| ### Dependency mismatch with companion packages | ||
|
|
||
| `@mui/x-data-grid`, `@mui/x-date-pickers`, and other MUI ecosystem packages should be upgraded together to avoid version skew. Mixed-version MUI packages can lead to subtle runtime issues that are difficult to diagnose later. | ||
|
|
||
| ## Implementation Notes | ||
|
|
||
| - Prefer a careful, incremental migration over a broad rewrite. | ||
| - Keep the patch focused on compatibility and behavior preservation. | ||
| - If a compatibility issue is discovered in a shared component, fix the shared abstraction rather than patching a single page in isolation. | ||
| - Document any intentional exceptions or workarounds in code comments only when they are required for correctness. | ||
|
|
||
| ## Definition of Done | ||
|
|
||
| The issue is complete when all acceptance criteria above are met, the frontend runs cleanly with MUI v7.x, and the project has no unresolved migration breakages in validation or local smoke testing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.