Skip to content

Commit 659ed6b

Browse files
feat: add full path label tooltip for workflow filter field (#16580)
# Closes Issue: Can't distinguish between fields with identical names (#16285) There was a UX bug in the workflow filter interface where **two variables coming from different steps but sharing the same field name** were displayed identically. This made it difficult for users to tell them apart when used in a filter group, leading to confusion when building workflows. --- # Fix: Add Full Path Label Tooltip for Workflow Filter Field - Adds a **tooltip/label showing the complete path** so users can distinguish fields from different workflow steps even if they share the same name. ## UX Improvements <img width="495" height="288" alt="image" src="https://github.com/user-attachments/assets/fa26f381-835b-4d14-bf73-f04b59c8d0b5" />
1 parent 30c2c22 commit 659ed6b

File tree

8 files changed

+33
-6
lines changed

8 files changed

+33
-6
lines changed

packages/twenty-front/src/modules/ui/input/components/SelectControl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const SelectControl = ({
8484
selectSizeVariant={selectSizeVariant}
8585
textAccent={textAccent}
8686
hasRightElement={hasRightElement}
87+
title={selectedOption.fullLabel}
8788
>
8889
{isDefined(selectedOption?.Icon) ? (
8990
<selectedOption.Icon

packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowStepFilterFieldSelect.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const WorkflowStepFilterFieldSelect = ({
5858
part: 'stepId',
5959
});
6060

61-
const { variableLabel } = useSearchVariable({
61+
const { variableLabel, variablePathLabel } = useSearchVariable({
6262
stepId,
6363
rawVariableName: stepFilter.stepOutputKey,
6464
isFullRecord: stepFilter.isFullRecord ?? false,
@@ -110,6 +110,7 @@ export const WorkflowStepFilterFieldSelect = ({
110110
selectedOption={{
111111
value: stepFilter.stepOutputKey,
112112
label: disabledLabel,
113+
fullLabel: variablePathLabel,
113114
Icon: icon,
114115
}}
115116
isDisabled={true}
@@ -127,6 +128,7 @@ export const WorkflowStepFilterFieldSelect = ({
127128
<SelectControl
128129
selectedOption={{
129130
label,
131+
fullLabel: variablePathLabel,
130132
value: stepFilter.stepOutputKey,
131133
Icon: icon,
132134
}}

packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useStepsOutputSchema.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export const useStepsOutputSchema = () => {
5757
type: step.type,
5858
icon: getActionIcon(step.type),
5959
outputSchema: (outputSchema ?? {}) as OutputSchemaV2,
60+
objectName: (step.settings?.input as { objectName?: string })
61+
?.objectName,
6062
};
6163

6264
set(stepsOutputSchemaFamilyState(stepKey), stepOutputSchema);

packages/twenty-front/src/modules/workflow/workflow-variables/types/StepOutputSchemaV2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ export type StepOutputSchemaV2 = {
2525
type: WorkflowTriggerType | WorkflowActionType;
2626
icon?: string;
2727
outputSchema: OutputSchemaV2;
28+
objectName?: string;
2829
};

packages/twenty-front/src/modules/workflow/workflow-variables/utils/searchVariableThroughFindRecordsOutputSchema.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ export const searchVariableThroughFindRecordsOutputSchema = ({
4545
searchRecordOutputSchema,
4646
rawVariableName,
4747
isFullRecord = false,
48+
stepNameLabel,
4849
}: {
4950
stepName: string;
5051
searchRecordOutputSchema: FindRecordsOutputSchema;
5152
rawVariableName: string;
5253
isFullRecord?: boolean;
54+
stepNameLabel?: string;
5355
}): VariableSearchResult => {
5456
if (!isDefined(searchRecordOutputSchema)) {
5557
return {
@@ -84,23 +86,33 @@ export const searchVariableThroughFindRecordsOutputSchema = ({
8486
selectedField: fieldName,
8587
path: pathSegments,
8688
isFullRecord,
89+
stepNameLabel,
8790
});
8891
}
8992

9093
if (searchResultKey === 'totalCount') {
94+
const label =
95+
searchRecordOutputSchema[searchResultKey]?.label ?? 'Total Count';
96+
const basePath = `${stepName} > ${label}`;
9197
return {
92-
variableLabel:
93-
searchRecordOutputSchema[searchResultKey]?.label ?? 'Total Count',
94-
variablePathLabel: `${stepName} > ${searchRecordOutputSchema[searchResultKey]?.label ?? 'Total Count'}`,
98+
variableLabel: label,
99+
variablePathLabel: stepNameLabel
100+
? `${basePath} (${stepNameLabel})`
101+
: basePath,
95102
variableType: FieldMetadataType.NUMBER,
96103
};
97104
}
98105

99106
if (searchResultKey === 'all') {
107+
const label =
108+
searchRecordOutputSchema[searchResultKey]?.label ?? 'All Records';
109+
const basePath = `${stepName} > ${label}`;
100110
return {
101111
variableLabel:
102112
searchRecordOutputSchema[searchResultKey]?.label ?? 'All Records',
103-
variablePathLabel: `${stepName} > ${searchRecordOutputSchema[searchResultKey]?.label ?? 'All Records'}`,
113+
variablePathLabel: stepNameLabel
114+
? `${basePath} (${stepNameLabel})`
115+
: basePath,
104116
variableType: FieldMetadataType.ARRAY,
105117
};
106118
}

packages/twenty-front/src/modules/workflow/workflow-variables/utils/searchVariableThroughOutputSchemaV2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export const searchVariableThroughOutputSchemaV2 = ({
6666
searchRecordOutputSchema: stepOutputSchema.outputSchema,
6767
rawVariableName,
6868
isFullRecord,
69+
stepNameLabel: stepOutputSchema.objectName,
6970
});
7071
}
7172

packages/twenty-front/src/modules/workflow/workflow-variables/utils/searchVariableThroughRecordOutputSchema.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const buildVariableResult = (
7777
targetSchema: RecordFieldNodeValue,
7878
targetFieldName: string,
7979
isFullRecord: boolean,
80+
stepNameLabel?: string,
8081
): VariableSearchResult => {
8182
const targetField = getFieldFromSchema(targetFieldName, targetSchema);
8283
// Determine the variable label based on whether we want the full record or a specific field
@@ -97,7 +98,10 @@ const buildVariableResult = (
9798

9899
// Build the full path: stepName > field1 > field2 > targetField
99100
const fullPathSegments = [stepName, ...pathLabels, variableLabel];
100-
const variablePathLabel = fullPathSegments.join(' > ');
101+
const basePath = fullPathSegments.join(' > ');
102+
const variablePathLabel = stepNameLabel
103+
? `${basePath} (${stepNameLabel})`
104+
: basePath;
101105

102106
return {
103107
variableLabel,
@@ -117,12 +121,14 @@ export const searchRecordOutputSchema = ({
117121
path,
118122
selectedField,
119123
isFullRecord,
124+
stepNameLabel,
120125
}: {
121126
stepName: string;
122127
recordOutputSchema: RecordOutputSchemaV2;
123128
path: string[];
124129
selectedField: string;
125130
isFullRecord: boolean;
131+
stepNameLabel?: string;
126132
}): VariableSearchResult => {
127133
const navigationResult = navigateToTargetField(recordOutputSchema, path);
128134

@@ -140,6 +146,7 @@ export const searchRecordOutputSchema = ({
140146
navigationResult.schema,
141147
selectedField,
142148
isFullRecord,
149+
stepNameLabel,
143150
);
144151
};
145152

packages/twenty-ui/src/input/types/SelectOption.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export type SelectOption<
66
> = {
77
Icon?: IconComponent | null;
88
label: string;
9+
fullLabel?: string;
910
value: Value;
1011
disabled?: boolean;
1112
color?: ThemeColor | 'transparent';

0 commit comments

Comments
 (0)