From 62845cac871d8c45c5f1ce9ddc8b4ab081dbdce2 Mon Sep 17 00:00:00 2001
From: Aman Raj <92664006+araj00@users.noreply.github.com>
Date: Sun, 25 Jan 2026 03:57:05 +0530
Subject: [PATCH] Fix the default value of search record if the filter is
boolean type (#17297)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes the #15896. For problem statement. Please refer to the shared
video mentioned in the issue.
---
> [!NOTE]
> Aligns filter defaults across UI by centralizing initial value
computation.
>
> - Add boolean handling in `useGetInitialFilterValue` to return
`value/displayValue` of `'false'` when operand is `IS`
> - Update `WorkflowDropdownStepOutputItems` to use
`getInitialFilterValue` for initial `value` instead of an empty string,
based on field type and default operand
>
> Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3ce05fa31aec1c9e771cb1b3ff20ddea3fab304f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).
---------
Co-authored-by: Félix Malfait
Co-authored-by: Félix Malfait
---
.../hooks/useGetInitialFilterValue.ts | 7 +++++++
.../WorkflowDropdownStepOutputItems.tsx | 16 ++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useGetInitialFilterValue.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useGetInitialFilterValue.ts
index 0efe97f0dc..5e1af325fa 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useGetInitialFilterValue.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useGetInitialFilterValue.ts
@@ -55,6 +55,13 @@ export const useGetInitialFilterValue = () => {
return { value: '', displayValue: '' };
}
+ break;
+ }
+ case 'BOOLEAN': {
+ if (newOperand === RecordFilterOperand.IS) {
+ return { value: 'false', displayValue: 'false' };
+ }
+
break;
}
}
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowDropdownStepOutputItems.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowDropdownStepOutputItems.tsx
index df56fab5ca..f03ece5969 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowDropdownStepOutputItems.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowDropdownStepOutputItems.tsx
@@ -5,6 +5,7 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM
import { useGetFieldMetadataItemByIdOrThrow } from '@/object-metadata/hooks/useGetFieldMetadataItemById';
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
+import { useGetInitialFilterValue } from '@/object-record/object-filter-dropdown/hooks/useGetInitialFilterValue';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
@@ -22,7 +23,10 @@ import { getVariableTemplateFromPath } from '@/workflow/workflow-variables/utils
import { searchVariableThroughOutputSchemaV2 } from '@/workflow/workflow-variables/utils/searchVariableThroughOutputSchemaV2';
import { useLingui } from '@lingui/react/macro';
import { useRecoilCallback } from 'recoil';
-import { type StepFilter } from 'twenty-shared/types';
+import {
+ type FilterableAndTSVectorFieldType,
+ type StepFilter,
+} from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { extractRawVariableNamePart } from 'twenty-shared/workflow';
import {
@@ -55,6 +59,8 @@ export const WorkflowDropdownStepOutputItems = ({
const workflowVersionId = useWorkflowVersionIdOrThrow();
const { objectMetadataItems } = useObjectMetadataItems();
+ const { getInitialFilterValue } = useGetInitialFilterValue();
+
const updateStepFilter = useRecoilCallback(
({ snapshot }) =>
({
@@ -101,13 +107,18 @@ export const WorkflowDropdownStepOutputItems = ({
});
const defaultOperand = availableOperandsForFilter[0];
+ const { value } = getInitialFilterValue(
+ filterType as FilterableAndTSVectorFieldType,
+ defaultOperand,
+ );
+
upsertStepFilterSettings({
stepFilterToUpsert: {
...stepFilter,
stepOutputKey: rawVariableName,
isFullRecord,
type: filterType ?? 'unknown',
- value: '',
+ value: value,
fieldMetadataId,
compositeFieldSubFieldName,
operand: defaultOperand,
@@ -120,6 +131,7 @@ export const WorkflowDropdownStepOutputItems = ({
getFieldMetadataItemByIdOrThrow,
upsertStepFilterSettings,
stepFilter,
+ getInitialFilterValue,
],
);