Do not enrich relations when id undefined (#13530)

Fixes https://github.com/twentyhq/twenty/issues/13428
We perform the call enrichment even with id undefined. It returns the
first item in DB.

Adding two more fixes related to filters:
- Conditions title
- Fixing placeholder color for select control (only other impacted field
is in Advanced filters)
This commit is contained in:
Thomas Trompette
2025-07-31 15:40:41 +02:00
committed by GitHub
parent 42c15b11f8
commit 664fd9fabd
4 changed files with 21 additions and 4 deletions
@@ -48,7 +48,7 @@ const StyledControlContainer = styled.div<{
? theme.font.color.tertiary
: textAccent === 'default'
? theme.font.color.primary
: theme.font.color.secondary};
: theme.font.color.tertiary};
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
text-align: left;
`;
@@ -1,3 +1,4 @@
import { InputLabel } from '@/ui/input/components/InputLabel';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { WorkflowFilterAction } from '@/workflow/types/Workflow';
import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody';
@@ -11,6 +12,7 @@ import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/workflow-ac
import { rootLevelStepFilterGroupComponentSelector } from '@/workflow/workflow-steps/workflow-actions/filter-action/states/rootLevelStepFilterGroupComponentSelector';
import { isStepFilterGroupChildAStepFilterGroup } from '@/workflow/workflow-steps/workflow-actions/filter-action/utils/isStepFilterGroupChildAStepFilterGroup';
import styled from '@emotion/styled';
import { t } from '@lingui/core/macro';
import { isDefined } from 'twenty-shared/utils';
const StyledContainer = styled.div`
@@ -27,6 +29,10 @@ const StyledChildContainer = styled.div`
width: 100%;
`;
const StyledFilterBodyContainer = styled(WorkflowStepBody)`
gap: ${({ theme }) => theme.spacing(0)};
`;
type WorkflowEditActionFilterBodyProps = {
action: WorkflowFilterAction;
actionOptions:
@@ -77,7 +83,8 @@ export const WorkflowEditActionFilterBody = ({
onFilterSettingsUpdate,
}}
>
<WorkflowStepBody>
<StyledFilterBodyContainer>
<InputLabel>{t`Conditions`}</InputLabel>
{isDefined(rootStepFilterGroup) ? (
<StyledContainer>
<StyledChildContainer>
@@ -111,7 +118,7 @@ export const WorkflowEditActionFilterBody = ({
) : (
<WorkflowStepFilterAddRootStepFilterButton />
)}
</WorkflowStepBody>
</StyledFilterBodyContainer>
</WorkflowStepFilterContext.Provider>
);
};
@@ -1,17 +1,22 @@
import { useAddRootStepFilter } from '@/workflow/workflow-steps/workflow-actions/filter-action/hooks/useAddRootStepFilter';
import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/workflow-actions/filter-action/states/context/WorkflowStepFilterContext';
import styled from '@emotion/styled';
import { useLingui } from '@lingui/react/macro';
import { useContext } from 'react';
import { IconFilter } from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
const StyledButton = styled(Button)`
margin-top: ${({ theme }) => theme.spacing(2)};
`;
export const WorkflowStepFilterAddRootStepFilterButton = () => {
const { t } = useLingui();
const { readonly } = useContext(WorkflowStepFilterContext);
const { addRootStepFilter } = useAddRootStepFilter();
return (
<Button
<StyledButton
Icon={IconFilter}
size="small"
variant="secondary"
@@ -189,6 +189,11 @@ export class DatabaseEventTriggerListener {
const joinField =
objectMetadataItemWithFieldsMaps.fieldsById[joinFieldId];
const joinRecordId = record[joinColumnName];
if (!isDefined(joinRecordId)) {
continue;
}
const relatedObjectMetadataId = joinField.relationTargetObjectMetadataId;
if (!isDefined(relatedObjectMetadataId)) {