Skip to content

[avatar] Remove deprecated props#47966

Merged
silviuaavram merged 12 commits intomui:masterfrom
silviuaavram:chore/remove-deprecated-props-2
Mar 18, 2026
Merged

[avatar] Remove deprecated props#47966
silviuaavram merged 12 commits intomui:masterfrom
silviuaavram:chore/remove-deprecated-props-2

Conversation

@silviuaavram
Copy link
Member

@silviuaavram silviuaavram commented Mar 13, 2026

Copilot AI review requested due to automatic review settings March 13, 2026 13:01
@silviuaavram silviuaavram changed the title Chore/remove deprecated props 2 [avatar] Remove deprecated props Mar 13, 2026
@mui-bot
Copy link

mui-bot commented Mar 13, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material ▼-80B(-0.02%) ▼-3B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 08727ed

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the deprecated imgProps prop from the Avatar component as part of the v9 migration. The useLoaded hook is extracted into its own TypeScript file with improved type safety and conditional property setting.

Changes:

  • Removed the deprecated imgProps prop from Avatar component, its types, PropTypes, and API docs
  • Extracted useLoaded into a separate TypeScript file (Avatar/utils/useLoaded.ts) with typed state and conditional property assignment
  • Updated docs and examples to use slotProps.img instead of imgProps

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/mui-material/src/Avatar/utils/useLoaded.ts New file: extracted and improved useLoaded hook with TypeScript types
packages/mui-material/src/Avatar/Avatar.js Removed imgProps prop, inline useLoaded, imported new hook
packages/mui-material/src/Avatar/Avatar.d.ts Removed imgProps from type definitions
packages/mui-material/src/Avatar/Avatar.test.js Removed one imgProps test (but missed another)
packages/mui-material/src/Avatar/Avatar.spec.tsx Removed imgProps type spec test
docs/src/modules/components/MaterialUIExampleCollection.js Migrated imgProps to slotProps.img
docs/src/components/about/Team.tsx Migrated imgProps to slotProps.img
docs/translations/api-docs/avatar/avatar.json Removed imgProps translation
docs/pages/material-ui/api/avatar.json Removed imgProps from API page
docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md Added migration guide for imgProps removal

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 13, 2026
@silviuaavram silviuaavram force-pushed the chore/remove-deprecated-props-2 branch from e37bbb1 to 2098dcd Compare March 13, 2026 14:42
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 13, 2026
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 16, 2026
@ZeeshanTamboli ZeeshanTamboli added breaking change Introduces changes that are not backward compatible. scope: avatar Changes related to the avatar. v9.x labels Mar 16, 2026
@silviuaavram silviuaavram force-pushed the chore/remove-deprecated-props-2 branch 2 times, most recently from c69dd1d to 0bdfe59 Compare March 16, 2026 12:40
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 16, 2026
"spread": true,
"themeDefaultProps": true,
"muiName": "MuiAvatar",
"forwardsRefTo": "HTMLDivElement",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could someone tell me why was this removed by the docs:api script? @ZeeshanTamboli @siriwatknp

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because you added another describeConformance without the ref param. It's what docs:api get the info from.

I recommend to remove the extra describeConformance, each test should have just one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed that describeConformance to also test the slots.img part, the first conformance tests slots.fallback and as far as I can tell, it can't work with both img and fallback.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 17, 2026
@silviuaavram silviuaavram force-pushed the chore/remove-deprecated-props-2 branch from 29e2fc5 to 08727ed Compare March 17, 2026 12:25
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 17, 2026
@silviuaavram silviuaavram requested a review from Copilot March 17, 2026 15:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the deprecated imgProps API from the Material UI Avatar component and updates tests/docs to rely on the slotProps.img slot customization API, aligning with the v9 upgrade/migration story.

Changes:

  • Remove imgProps from Avatar implementation, PropTypes, and TypeScript types, and update the TS spec accordingly.
  • Update Avatar tests to drop legacy imgProps coverage and add conformance coverage for the img slot when an image is rendered.
  • Update docs/examples and API JSON/docs translations to remove references to imgProps, and add a v9 upgrade note with codemod guidance.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/mui-material/src/Avatar/Avatar.js Removes imgProps handling and relies on slotProps.img for img attributes and useLoaded inputs.
packages/mui-material/src/Avatar/Avatar.d.ts Drops the imgProps type from the public TS API.
packages/mui-material/src/Avatar/Avatar.test.js Removes legacy imgProps tests and adds conformance coverage for the img slot when src is provided.
packages/mui-material/src/Avatar/Avatar.spec.tsx Updates TS compile-time coverage to validate slotProps.img supports sx.
docs/translations/api-docs/avatar/avatar.json Removes imgProps from translated API docs payload.
docs/pages/material-ui/api/avatar.json Removes imgProps from the generated API JSON.
docs/src/modules/components/MaterialUIExampleCollection.js Migrates example usage from imgProps to slotProps.img.
docs/src/components/about/Team.tsx Migrates example usage from imgProps to slotProps.img.
docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md Adds an upgrade note documenting the removal and the codemod command.
Comments suppressed due to low confidence (1)

packages/mui-material/src/Avatar/Avatar.js:159

  • With imgProps removed from the destructuring, any remaining imgProps passed by consumers (or via theme defaultProps) will now fall into ...other and be forwarded to the root DOM element, causing React “unknown prop” warnings and potentially rendering imgprops="[object Object]" in the DOM. Even if the prop is removed, it’s better to explicitly pick/omit imgProps (and ignore it) so it doesn’t leak to the root slot.
    src,
    srcSet,
    variant = 'circular',
    ...other
  } = props;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@silviuaavram silviuaavram merged commit 31b2704 into mui:master Mar 18, 2026
27 checks passed
@silviuaavram silviuaavram deleted the chore/remove-deprecated-props-2 branch March 18, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible. scope: avatar Changes related to the avatar. v9.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants