Skip to content

Commit d770ab4

Browse files
fix(avatar): 🩹 fix calling hooks inside hooks bug (#337)
1 parent 9a50de2 commit d770ab4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/avatar/AvatarProps.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export const useAvatarProps = ({
6363
crossOrigin,
6464
loading,
6565
});
66-
let uiProps: AvatarUIProps = useMemo(() => ({ ...uiState }), [uiState]);
66+
let uiProps: AvatarUIProps = uiState;
67+
6768
const { componentProps } = getComponentProps(componentMap, children, uiProps);
6869

6970
const _icon: AvatarUIState["icon"] =
@@ -129,13 +130,14 @@ export const useAvatarProps = ({
129130
],
130131
);
131132

133+
const finalStatusIndicators = withIconA11y(uiProps.statusIndicators, uiProps);
132134
const statusIndicatorProps: AvatarStatusIndicatorProps = useMemo(
133135
() => ({
134136
...uiProps,
135137
...componentProps.statusIndicatorProps,
136-
children: withIconA11y(uiProps.statusIndicators, uiProps),
138+
children: finalStatusIndicators,
137139
}),
138-
[componentProps.statusIndicatorProps, uiProps],
140+
[componentProps.statusIndicatorProps, finalStatusIndicators, uiProps],
139141
);
140142

141143
return {

0 commit comments

Comments
 (0)