Search record action - allow to search more than 1 record (#14769)

https://github.com/user-attachments/assets/426da6af-6c6b-4d49-9034-0aa041cb331f
This commit is contained in:
Thomas Trompette
2025-09-30 12:07:25 +02:00
committed by GitHub
parent 4b87908752
commit b7cdf9183a
9 changed files with 177 additions and 47 deletions
@@ -1,18 +1,47 @@
import { stepsOutputSchemaFamilyState } from '@/workflow/states/stepsOutputSchemaFamilyState';
import { type WorkflowVersion } from '@/workflow/types/Workflow';
import {
type WorkflowActionType,
type WorkflowVersion,
} from '@/workflow/types/Workflow';
import { getStepOutputSchemaFamilyStateKey } from '@/workflow/utils/getStepOutputSchemaFamilyStateKey';
import { getActionIcon } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIcon';
import { getTriggerDefaultLabel } from '@/workflow/workflow-trigger/utils/getTriggerDefaultLabel';
import { getTriggerIcon } from '@/workflow/workflow-trigger/utils/getTriggerIcon';
import { isFindRecordsOutputSchema } from '@/workflow/workflow-variables/types/guards/isFindRecordsOutputSchema';
import {
type OutputSchemaV2,
type StepOutputSchemaV2,
} from '@/workflow/workflow-variables/types/StepOutputSchemaV2';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useRecoilCallback } from 'recoil';
import { isDefined } from 'twenty-shared/utils';
import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';
import { FeatureFlagKey } from '~/generated/graphql';
const getFilteredOutputSchema = ({
stepType,
outputSchema,
isIteratorEnabled,
}: {
stepType: WorkflowActionType;
outputSchema: OutputSchemaV2;
isIteratorEnabled: boolean;
}) => {
if (!isIteratorEnabled && isFindRecordsOutputSchema(stepType, outputSchema)) {
const filteredOutputSchema = {
...outputSchema,
all: undefined,
};
return filteredOutputSchema;
}
return outputSchema;
};
export const useStepsOutputSchema = () => {
const isIteratorEnabled = useIsFeatureEnabled(
FeatureFlagKey.IS_WORKFLOW_ITERATOR_ENABLED,
);
const populateStepsOutputSchema = useRecoilCallback(
({ set }) =>
(workflowVersion: WorkflowVersion) => {
@@ -22,7 +51,11 @@ export const useStepsOutputSchema = () => {
name: step.name,
type: step.type,
icon: getActionIcon(step.type),
outputSchema: step.settings?.outputSchema as OutputSchemaV2,
outputSchema: getFilteredOutputSchema({
stepType: step.type,
outputSchema: step.settings?.outputSchema as OutputSchemaV2,
isIteratorEnabled,
}),
};
set(
@@ -59,7 +92,7 @@ export const useStepsOutputSchema = () => {
);
}
},
[],
[isIteratorEnabled],
);
const deleteStepsOutputSchema = useRecoilCallback(