diff --git a/packages/sn-controls-react/src/fieldcontrols/reference-grid/reference-picker.tsx b/packages/sn-controls-react/src/fieldcontrols/reference-grid/reference-picker.tsx index 28264d128..efbdb2444 100644 --- a/packages/sn-controls-react/src/fieldcontrols/reference-grid/reference-picker.tsx +++ b/packages/sn-controls-react/src/fieldcontrols/reference-grid/reference-picker.tsx @@ -47,28 +47,25 @@ export const ReferencePicker: React.FC { - if (props.repository.schemas.isContentFromType(item, 'User')) { - const avatarUrl = item.Avatar?.Url - if (avatarUrl) { - return - } - - return ( + const renderIcon = (item: GenericContentWithIsParent | User) => + props.repository.schemas.isContentFromType(item, 'User') ? ( + (item as User).Avatar?.Url ? ( + + ) : ( {item.DisplayName?.split(' ') .map((namePart) => namePart[0]) .join('.')} ) - } - - if (props.renderIcon) { - return props.renderIcon(item) - } - - return renderIconDefault(iconName(item.IsFolder)) - } + ) : props.renderIcon ? ( + props.renderIcon(item) + ) : ( + renderIconDefault(iconName(item.IsFolder)) + ) return (