@@ -169,19 +169,6 @@ const Avatar = React.forwardRef(function Avatar(inProps, ref) {
169
169
grouped : ! ! groupContext ,
170
170
} ;
171
171
172
- // Use a hook instead of onError on the img element to support server-side rendering.
173
- const loaded = useLoaded ( {
174
- ...imgProps ,
175
- ...( typeof other . slotProps ?. img === 'function'
176
- ? other . slotProps ?. img ( ownerState )
177
- : other . slotProps ?. img ) ,
178
- src,
179
- srcSet,
180
- } ) ;
181
-
182
- const hasImg = src || srcSet ;
183
- const hasImgNotFailing = hasImg && loaded !== 'error' ;
184
-
185
172
const classes = useUtilityClasses ( ownerState ) ;
186
173
187
174
const [ SlotRoot , rootProps ] = useSlot ( 'root' , {
@@ -212,6 +199,17 @@ const Avatar = React.forwardRef(function Avatar(inProps, ref) {
212
199
ownerState,
213
200
} ) ;
214
201
202
+ // Use a hook instead of onError on the img element to support server-side rendering.
203
+ const loaded = useLoaded ( {
204
+ ...imgProps ,
205
+ ...imageProps ,
206
+ src,
207
+ srcSet,
208
+ } ) ;
209
+
210
+ const hasImg = src || srcSet ;
211
+ const hasImgNotFailing = hasImg && loaded !== 'error' ;
212
+
215
213
if ( hasImgNotFailing ) {
216
214
children = < SlotImg { ...imageProps } /> ;
217
215
} else if ( childrenProp != null ) {
@@ -262,14 +260,6 @@ Avatar.propTypes /* remove-proptypes */ = {
262
260
PropTypes . oneOf ( [ 'lg' , 'md' , 'sm' ] ) ,
263
261
PropTypes . string ,
264
262
] ) ,
265
- /**
266
- * @ignore
267
- */
268
- slotProps : PropTypes . shape ( {
269
- fallback : PropTypes . oneOfType ( [ PropTypes . func , PropTypes . object ] ) ,
270
- img : PropTypes . oneOfType ( [ PropTypes . func , PropTypes . object ] ) ,
271
- root : PropTypes . oneOfType ( [ PropTypes . func , PropTypes . object ] ) ,
272
- } ) ,
273
263
/**
274
264
* The `src` attribute for the `img` element.
275
265
*/
0 commit comments