Skip to content

Commit

Permalink
fix(avatar): 🩹 fix calling hooks inside hooks bug (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
navin-moorthy committed Jul 4, 2022
1 parent 9a50de2 commit d770ab4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/avatar/AvatarProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export const useAvatarProps = ({
crossOrigin,
loading,
});
let uiProps: AvatarUIProps = useMemo(() => ({ ...uiState }), [uiState]);
let uiProps: AvatarUIProps = uiState;

const { componentProps } = getComponentProps(componentMap, children, uiProps);

const _icon: AvatarUIState["icon"] =
Expand Down Expand Up @@ -129,13 +130,14 @@ export const useAvatarProps = ({
],
);

const finalStatusIndicators = withIconA11y(uiProps.statusIndicators, uiProps);
const statusIndicatorProps: AvatarStatusIndicatorProps = useMemo(
() => ({
...uiProps,
...componentProps.statusIndicatorProps,
children: withIconA11y(uiProps.statusIndicators, uiProps),
children: finalStatusIndicators,
}),
[componentProps.statusIndicatorProps, uiProps],
[componentProps.statusIndicatorProps, finalStatusIndicators, uiProps],
);

return {
Expand Down

1 comment on commit d770ab4

@vercel
Copy link

@vercel vercel bot commented on d770ab4 Jul 4, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.