Skip to content

Comments

fix(x2a): Downgrade mui dependencies#2369

Open
eloycoto wants to merge 1 commit intoredhat-developer:mainfrom
eloycoto:MUIComponents
Open

fix(x2a): Downgrade mui dependencies#2369
eloycoto wants to merge 1 commit intoredhat-developer:mainfrom
eloycoto:MUIComponents

Conversation

@eloycoto
Copy link
Contributor

@eloycoto eloycoto commented Feb 20, 2026

User description

When using RHDH operator, the mui packages are on lower version, so I need to downgrade the version to get it running correctly on rhdh operator.


PR Type

Bug fix, Enhancement


Description

  • Downgrade MUI dependencies to versions compatible with RHDH operator

  • Update PieChart API usage to match MUI v5 syntax

  • Add @mui/system dependency for v5 compatibility


Diagram Walkthrough

flowchart LR
  A["MUI v7/v8 Dependencies"] -- "Downgrade to v5" --> B["@mui/material v5.15.14"]
  A -- "Downgrade to v7" --> C["@mui/x-charts v7.0.0"]
  A -- "Add new" --> D["@mui/system v5.15.14"]
  B --> E["Update PieChart API"]
  C --> E
  E -- "hideLegend → slotProps" --> F["ProjectStatusCell Updated"]
Loading

File Walkthrough

Relevant files
Dependencies
package.json
Downgrade MUI package versions for compatibility                 

workspaces/x2a/plugins/x2a/package.json

  • Downgrade @mui/material from v7.3.7 to v5.15.14
  • Downgrade @mui/x-charts from v8.27.0 to v7.0.0
  • Add new @mui/system dependency at v5.15.14
+3/-2     
Enhancement
ProjectStatusCell.tsx
Update PieChart API for MUI v5 compatibility                         

workspaces/x2a/plugins/x2a/src/components/ProjectList/ProjectStatusCell.tsx

  • Replace deprecated hideLegend prop with slotProps API
  • Update PieChart component to use MUI v5 compatible syntax
  • Maintain existing functionality with new prop structure
+1/-1     

@rhdh-gh-app
Copy link

rhdh-gh-app bot commented Feb 20, 2026

Missing Changesets

The following package(s) are changed by this PR but do not have a changeset:

  • @red-hat-developer-hub/backstage-plugin-x2a

See CONTRIBUTING.md for more information about how to add changesets.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-x2a workspaces/x2a/plugins/x2a none v1.0.1

@rhdh-qodo-merge
Copy link

rhdh-qodo-merge bot commented Feb 20, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
🟢
No codebase code duplication found No new components were introduced in the PR code
Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@rhdh-qodo-merge
Copy link

rhdh-qodo-merge bot commented Feb 20, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Memoize legend slotProps

Memoize the slotProps object using useMemo to prevent it from being recreated on
every render, which can improve performance by avoiding unnecessary re-renders
of the PieChart component.

workspaces/x2a/plugins/x2a/src/components/ProjectList/ProjectStatusCell.tsx [145]

-slotProps={{ legend: { hidden: true } }}
+const legendSlotProps = useMemo(
+  () => ({ legend: { hidden: true } }),
+  [],
+);
+...
+slotProps={legendSlotProps}

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies a potential performance issue where a new object is created for the slotProps prop on every render. Using useMemo is a valid and good practice to prevent unnecessary re-renders of the child component.

Low
Use direct legend prop

Simplify the code by using the legend={{ hidden: true }} prop directly on the
PieChart component, which is a supported shorthand for slotProps in MUI X Charts
v7.

workspaces/x2a/plugins/x2a/src/components/ProjectList/ProjectStatusCell.tsx [145]

-slotProps={{ legend: { hidden: true } }}
+legend={{ hidden: true }}
  • Apply / Chat
Suggestion importance[1-10]: 4

__

Why: This suggestion correctly points out that @mui/x-charts v7 allows using the legend prop as a shorthand for slotProps.legend. Applying this change would improve code readability and conciseness.

Low
  • Update

When using RHDH operator, the mui packages are on lower version, so I need to downgrade the version to get it running correctly on rhdh operator.

Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant