fix: Filter Selection Icon Missing #13901 (#13950)

Fixed issue #13901



https://github.com/user-attachments/assets/4aa7d0f3-88b8-474f-85e5-b2989ed8afdd

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Kailash Rajput
2025-08-18 20:24:26 +05:30
committed by GitHub
parent 43bb8d6043
commit 5e905d3004
27 changed files with 505 additions and 2110 deletions
@@ -62,17 +62,17 @@ export const WorkflowVariablesDropdownFieldItems = ({
/>
<DropdownMenuSeparator />
<DropdownMenuItemsContainer hasMaxHeight>
{filteredOptions.map(([key, subStep]) => (
{filteredOptions.map(([key, option]) => (
<MenuItemSelect
key={key}
selected={false}
focused={false}
onClick={() => handleSelectField(key)}
text={subStep.label || key}
hasSubMenu={!subStep.isLeaf}
LeftIcon={subStep.icon ? getIcon(subStep.icon) : undefined}
text={option.label || key}
hasSubMenu={!option.isLeaf}
LeftIcon={option.icon ? getIcon(option.icon) : undefined}
contextualText={
subStep.isLeaf ? subStep?.value?.toString() : undefined
option.isLeaf ? option?.value?.toString() : undefined
}
/>
))}
@@ -33,6 +33,7 @@ type UseVariableDropdownReturn = {
setSearchInputValue: (value: string) => void;
handleSelectField: (key: string) => void;
goBack: () => void;
// TODO: fix typing here
filteredOptions: [string, any][];
};
@@ -31,6 +31,10 @@ type Link = {
export type BaseOutputSchema = Record<string, Leaf | Node>;
export type FieldOutputSchema = (Leaf | Node) & {
fieldMetadataId: string;
};
export type RecordOutputSchema = {
object: {
nameSingular: string;
@@ -38,7 +42,7 @@ export type RecordOutputSchema = {
objectMetadataId: string;
isRelationField?: boolean;
} & Leaf;
fields: BaseOutputSchema;
fields: Record<string, FieldOutputSchema>;
_outputSchemaType: 'RECORD';
};
@@ -19,7 +19,12 @@ const mockStep = {
objectMetadataId: '123',
},
fields: {
name: { label: 'Name', value: 'Twenty', isLeaf: true },
name: {
label: 'Name',
value: 'Twenty',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
},
_outputSchemaType: 'RECORD',
},
@@ -19,16 +19,42 @@ const mockStep = {
objectMetadataId: '123',
},
fields: {
name: { label: 'Name', value: 'Twenty', isLeaf: true },
name: {
label: 'Name',
value: 'Twenty',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174001',
},
address: {
label: 'Address',
value: {
street: { label: 'Street', value: '123 Main St', isLeaf: true },
city: { label: 'City', value: 'New York', isLeaf: true },
state: { label: 'State', value: 'NY', isLeaf: true },
zip: { label: 'Zip', value: '10001', isLeaf: true },
},
isLeaf: false,
label: 'Address',
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
value: {
street: {
label: 'Street',
value: '123 Main St',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
city: {
label: 'City',
value: 'New York',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
state: {
label: 'State',
value: 'NY',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
zip: {
label: 'Zip',
value: '10001',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
},
},
},
_outputSchemaType: 'RECORD',
@@ -22,8 +22,18 @@ describe('searchVariableThroughOutputSchema', () => {
objectMetadataId: '123',
},
fields: {
name: { label: 'Name', value: 'Twenty', isLeaf: true },
address: { label: 'Address', value: '123 Main St', isLeaf: true },
name: {
label: 'Name',
value: 'Twenty',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
address: {
label: 'Address',
value: '123 Main St',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
},
_outputSchemaType: 'RECORD',
},
@@ -42,12 +52,23 @@ describe('searchVariableThroughOutputSchema', () => {
objectMetadataId: '123',
},
fields: {
firstName: { label: 'First Name', value: 'Jane', isLeaf: true },
lastName: { label: 'Last Name', value: 'Doe', isLeaf: true },
firstName: {
label: 'First Name',
value: 'Jane',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
lastName: {
label: 'Last Name',
value: 'Doe',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
email: {
label: 'Email',
value: 'jane@example.com',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
},
_outputSchemaType: 'RECORD',
@@ -90,6 +111,8 @@ describe('searchVariableThroughOutputSchema', () => {
});
expect(result).toEqual({
compositeFieldSubFieldName: undefined,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
variableLabel: 'Name',
variablePathLabel: 'Step 1 > Company > Name',
variableType: 'unknown',
@@ -104,6 +127,8 @@ describe('searchVariableThroughOutputSchema', () => {
});
expect(result).toEqual({
compositeFieldSubFieldName: undefined,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
variableLabel: 'Email',
variablePathLabel: 'Step 1 > Person > Email',
variableType: 'unknown',
@@ -237,6 +262,7 @@ describe('searchVariableThroughOutputSchema', () => {
label: 'Id',
value: '123e4567-e89b-12d3-a456-426614174000',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
'properties.after.name': {
icon: 'IconBuildingSkyscraper',
@@ -244,22 +270,28 @@ describe('searchVariableThroughOutputSchema', () => {
label: 'Name',
value: 'My text',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
},
'properties.after.annualRecurringRevenue': {
icon: 'IconMoneybag',
label: 'ARR',
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
value: {
amountMicros: {
type: FieldMetadataType.NUMERIC,
label: ' Amount Micros',
value: null,
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
isCompositeSubField: true,
},
currencyCode: {
type: FieldMetadataType.TEXT,
label: ' Currency Code',
value: 'My text',
isLeaf: true,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
isCompositeSubField: true,
},
},
isLeaf: false,
@@ -285,6 +317,8 @@ describe('searchVariableThroughOutputSchema', () => {
});
expect(result).toEqual({
compositeFieldSubFieldName: undefined,
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
variableLabel: 'Name',
variablePathLabel: 'Record is Created > Name',
variableType: FieldMetadataType.TEXT,
@@ -300,6 +334,8 @@ describe('searchVariableThroughOutputSchema', () => {
});
expect(result).toEqual({
compositeFieldSubFieldName: 'amountMicros',
fieldMetadataId: '123e4567-e89b-12d3-a456-426614174000',
variableLabel: ' Amount Micros',
variablePathLabel: 'Record is Created > ARR > Amount Micros',
variableType: FieldMetadataType.NUMERIC,
@@ -1,6 +1,7 @@
import { type InputSchemaPropertyType } from '@/workflow/types/InputSchema';
import {
type BaseOutputSchema,
type FieldOutputSchema,
type OutputSchema,
type RecordOutputSchema,
} from '@/workflow/workflow-variables/types/StepOutputSchema';
@@ -35,7 +36,7 @@ const filterRecordOutputSchema = ({
shouldDisplayRecordFields: boolean;
shouldDisplayRecordObjects: boolean;
}): RecordOutputSchema | undefined => {
const filteredFields: BaseOutputSchema = {};
const filteredFields: Record<string, FieldOutputSchema> = {};
let hasValidFields = false;
for (const key in outputSchema.fields) {
@@ -135,8 +136,8 @@ const filterRecordOutputSchemaFieldsByType = ({
}: {
outputSchema: RecordOutputSchema;
fieldTypesToExclude: InputSchemaPropertyType[];
}) => {
const filteredFields: BaseOutputSchema = {};
}): RecordOutputSchema => {
const filteredFields: Record<string, FieldOutputSchema> = {};
for (const key in outputSchema.fields) {
const field = outputSchema.fields[key];