Revert "fix: prevent default object re-selection in relation field fo… (#17619)
I suggest to revert [this PR](https://github.com/twentyhq/twenty/pull/17313) as it had already been fixed [in this PR](https://github.com/twentyhq/twenty/pull/17209/changes) (which fixes more than it says in its title). Issue was tracked by [this ticket](https://github.com/twentyhq/core-team-issues/issues/2049) not very explicit - sorry, my fault. Code added in the PR does not add value
This commit is contained in:
@@ -20,7 +20,6 @@ type MultiSelectControlProps = Omit<SelectControlProps, 'selectedOption'> & {
|
||||
fixedIcon?: IconComponent;
|
||||
fixedText?: string;
|
||||
selectedOptions: MultiSelectOptionType[];
|
||||
placeholderText?: string;
|
||||
};
|
||||
|
||||
export const MultiSelectControl = ({
|
||||
@@ -31,22 +30,16 @@ export const MultiSelectControl = ({
|
||||
selectSizeVariant,
|
||||
textAccent = 'default',
|
||||
hasRightElement,
|
||||
placeholderText,
|
||||
}: MultiSelectControlProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
const firstSelectedOption = selectedOptions[0];
|
||||
const hasSelection = selectedOptions.length > 0;
|
||||
|
||||
const firstSelectedOption = selectedOptions?.[0];
|
||||
return (
|
||||
<StyledControlContainer
|
||||
disabled={isDisabled}
|
||||
hasIcon={
|
||||
isDefined(fixedIcon) ||
|
||||
(hasSelection && isDefined(firstSelectedOption?.Icon))
|
||||
}
|
||||
hasIcon={isDefined(fixedIcon) || isDefined(firstSelectedOption?.Icon)}
|
||||
selectSizeVariant={selectSizeVariant}
|
||||
textAccent={hasSelection ? textAccent : 'placeholder'}
|
||||
textAccent={textAccent}
|
||||
hasRightElement={hasRightElement}
|
||||
>
|
||||
{isDefined(fixedIcon) ? (
|
||||
@@ -55,7 +48,7 @@ export const MultiSelectControl = ({
|
||||
size: theme.icon.size.md,
|
||||
stroke: theme.icon.stroke.sm,
|
||||
})
|
||||
) : hasSelection && isDefined(firstSelectedOption.Icon) ? (
|
||||
) : isDefined(firstSelectedOption?.Icon) ? (
|
||||
<firstSelectedOption.Icon
|
||||
color={isDisabled ? theme.font.color.light : theme.font.color.primary}
|
||||
size={theme.icon.size.md}
|
||||
@@ -64,11 +57,9 @@ export const MultiSelectControl = ({
|
||||
) : null}
|
||||
{isDefined(fixedText) ? (
|
||||
<OverflowingTextWithTooltip text={fixedText} />
|
||||
) : hasSelection ? (
|
||||
<OverflowingTextWithTooltip text={firstSelectedOption.label} />
|
||||
) : isDefined(placeholderText) ? (
|
||||
<OverflowingTextWithTooltip text={placeholderText} />
|
||||
) : null}
|
||||
) : (
|
||||
<OverflowingTextWithTooltip text={firstSelectedOption?.label ?? ''} />
|
||||
)}
|
||||
|
||||
<StyledSelectControlIconChevronDown
|
||||
disabled={isDisabled}
|
||||
|
||||
Reference in New Issue
Block a user