From 369abfe4248b6c414bfc103cd61b2ea8cc42b878 Mon Sep 17 00:00:00 2001 From: Thomas Trompette Date: Thu, 20 Mar 2025 10:58:02 +0100 Subject: [PATCH] Rename onPersist to onChange for form fields (#11047) We are about to build forms where fields will not be persisted immediately. It will have to be submitted. Renaming the prop to reflect it. --- .../components/FormFieldInput.tsx | 34 +++++++------- .../components/FormAddressFieldInput.tsx | 18 ++++---- .../components/FormBooleanFieldInput.tsx | 10 ++-- .../components/FormCountryCodeSelectInput.tsx | 12 ++--- .../components/FormCountrySelectInput.tsx | 12 ++--- .../components/FormCurrencyFieldInput.tsx | 14 +++--- .../components/FormDateFieldInput.tsx | 6 +-- .../components/FormDateTimeFieldInput.tsx | 12 ++--- .../components/FormEmailsFieldInput.tsx | 8 ++-- .../components/FormFullNameFieldInput.tsx | 16 +++---- .../components/FormLinksFieldInput.tsx | 10 ++-- .../components/FormMultiSelectFieldInput.tsx | 10 ++-- .../components/FormNumberFieldInput.tsx | 14 +++--- .../components/FormPhoneFieldInput.tsx | 12 ++--- .../components/FormRawJsonFieldInput.tsx | 8 ++-- .../components/FormSelectFieldInput.tsx | 12 ++--- .../components/FormTextFieldInput.tsx | 6 +-- .../components/FormUuidFieldInput.tsx | 12 ++--- .../FormAddressFieldInput.stories.tsx | 4 +- .../FormDateFieldInput.stories.tsx | 34 +++++++------- .../FormDateTimeFieldInput.stories.tsx | 38 +++++++-------- .../FormEmailsFieldInput.stories.tsx | 4 +- .../FormFullNameFieldInput.stories.tsx | 4 +- .../FormLinksFieldInput.stories.tsx | 6 +-- .../FormMultiSelectFieldInput.stories.tsx | 6 +-- .../FormPhoneFieldInput.stories.tsx | 16 +++---- .../FormRawJsonFieldInput.stories.tsx | 46 +++++++++---------- .../FormSelectFieldInput.stories.tsx | 6 +-- .../FormTextFieldInput.stories.tsx | 24 +++++----- .../FormUuidFieldInput.stories.tsx | 22 ++++----- .../WorkflowEditActionCreateRecord.tsx | 2 +- .../WorkflowEditActionFindRecords.tsx | 2 +- .../WorkflowEditActionSendEmail.tsx | 6 +-- ...flowEditActionServerlessFunctionFields.tsx | 2 +- .../WorkflowEditActionUpdateRecord.tsx | 4 +- .../WorkflowEditActionFormFieldSettings.tsx | 2 +- .../WorkflowFormFieldSettingsNumber.tsx | 4 +- .../WorkflowFormFieldSettingsText.tsx | 4 +- .../WorkflowEditTriggerCronForm.tsx | 14 +++--- 39 files changed, 238 insertions(+), 238 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/record-field/components/FormFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/components/FormFieldInput.tsx index 75fd09a47..c665ab7e9 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/components/FormFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/components/FormFieldInput.tsx @@ -45,7 +45,7 @@ import { JsonValue } from 'type-fest'; type FormFieldInputProps = { field: FieldDefinition; defaultValue: JsonValue; - onPersist: (value: JsonValue) => void; + onChange: (value: JsonValue) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -53,7 +53,7 @@ type FormFieldInputProps = { export const FormFieldInput = ({ field, defaultValue, - onPersist, + onChange, VariablePicker, readonly, }: FormFieldInputProps) => { @@ -61,7 +61,7 @@ export const FormFieldInput = ({ @@ -78,7 +78,7 @@ export const FormFieldInput = ({ @@ -106,7 +106,7 @@ export const FormFieldInput = ({ @@ -114,7 +114,7 @@ export const FormFieldInput = ({ @@ -122,7 +122,7 @@ export const FormFieldInput = ({ @@ -130,7 +130,7 @@ export const FormFieldInput = ({ @@ -138,7 +138,7 @@ export const FormFieldInput = ({ @@ -146,7 +146,7 @@ export const FormFieldInput = ({ @@ -154,7 +154,7 @@ export const FormFieldInput = ({ diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormAddressFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormAddressFieldInput.tsx index 6feb38319..6cc90d4b2 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormAddressFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormAddressFieldInput.tsx @@ -10,7 +10,7 @@ import { InputLabel } from '@/ui/input/components/InputLabel'; type FormAddressFieldInputProps = { label?: string; defaultValue?: FieldAddressDraftValue | null; - onPersist: (value: FieldAddressValue) => void; + onChange: (value: FieldAddressValue) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -18,7 +18,7 @@ type FormAddressFieldInputProps = { export const FormAddressFieldInput = ({ label, defaultValue, - onPersist, + onChange, readonly, VariablePicker, }: FormAddressFieldInputProps) => { @@ -35,7 +35,7 @@ export const FormAddressFieldInput = ({ addressLng: defaultValue?.addressLng ?? null, [field]: updatedAddressPart, }; - onPersist(updatedAddress); + onChange(updatedAddress); }; return ( @@ -45,7 +45,7 @@ export const FormAddressFieldInput = ({ diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormBooleanFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormBooleanFieldInput.tsx index f33ac3507..f9f5bc1a9 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormBooleanFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormBooleanFieldInput.tsx @@ -17,7 +17,7 @@ const StyledBooleanInputContainer = styled.div` type FormBooleanFieldInputProps = { label?: string; defaultValue: boolean | string | undefined; - onPersist: (value: boolean | null | string) => void; + onChange: (value: boolean | null | string) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -25,7 +25,7 @@ type FormBooleanFieldInputProps = { export const FormBooleanFieldInput = ({ label, defaultValue, - onPersist, + onChange, readonly, VariablePicker, }: FormBooleanFieldInputProps) => { @@ -58,7 +58,7 @@ export const FormBooleanFieldInput = ({ value: newValue, }); - onPersist(newValue); + onChange(newValue); }; const handleVariableTagInsert = (variableName: string) => { @@ -67,7 +67,7 @@ export const FormBooleanFieldInput = ({ value: variableName, }); - onPersist(variableName); + onChange(variableName); }; const handleUnlinkVariable = () => { @@ -76,7 +76,7 @@ export const FormBooleanFieldInput = ({ value: false, }); - onPersist(false); + onChange(false); }; return ( diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormCountryCodeSelectInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormCountryCodeSelectInput.tsx index ca3c8f724..0728db47d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormCountryCodeSelectInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormCountryCodeSelectInput.tsx @@ -11,12 +11,12 @@ export type FormCountryCodeSelectInputUpdatedValue = CountryCode | ''; export const FormCountryCodeSelectInput = ({ selectedCountryCode, - onPersist, + onChange, readonly = false, VariablePicker, }: { selectedCountryCode: string; - onPersist: (countryCode: FormCountryCodeSelectInputUpdatedValue) => void; + onChange: (countryCode: FormCountryCodeSelectInputUpdatedValue) => void; readonly?: boolean; VariablePicker?: VariablePickerComponent; }) => { @@ -42,22 +42,22 @@ export const FormCountryCodeSelectInput = ({ ]; }, [countries]); - const onChange = (countryCode: string | null) => { + const onCountryCodeChange = (countryCode: string | null) => { if (readonly) { return; } if (countryCode === null) { - onPersist(''); + onChange(''); } else { - onPersist(countryCode as CountryCode); + onChange(countryCode as CountryCode); } }; return ( void; + onChange: (country: string) => void; readonly?: boolean; VariablePicker?: VariablePickerComponent; }) => { @@ -39,22 +39,22 @@ export const FormCountrySelectInput = ({ ]; }, [countries]); - const onChange = (country: string | null) => { + const onCountryChange = (country: string | null) => { if (readonly) { return; } if (country === null) { - onPersist(''); + onChange(''); } else { - onPersist(country); + onChange(country); } }; return ( void; + onChange: (value: FormFieldCurrencyValue) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -20,7 +20,7 @@ type FormCurrencyFieldInputProps = { export const FormCurrencyFieldInput = ({ label, defaultValue, - onPersist, + onChange, VariablePicker, readonly, }: FormCurrencyFieldInputProps) => { @@ -37,14 +37,14 @@ export const FormCurrencyFieldInput = ({ const handleAmountMicrosChange = ( newAmountMicros: string | number | null, ) => { - onPersist({ + onChange({ currencyCode: defaultValue?.currencyCode ?? null, amountMicros: newAmountMicros ?? null, }); }; const handleCurrencyCodeChange = (newCurrencyCode: string | null) => { - onPersist({ + onChange({ currencyCode: (newCurrencyCode as CurrencyCode) ?? null, amountMicros: defaultValue?.amountMicros ?? null, }); @@ -57,7 +57,7 @@ export const FormCurrencyFieldInput = ({ diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateFieldInput.tsx index 2e411bacf..ac6d0fc8b 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateFieldInput.tsx @@ -4,7 +4,7 @@ import { VariablePickerComponent } from '@/object-record/record-field/form-types type FormDateFieldInputProps = { label?: string; defaultValue: string | undefined; - onPersist: (value: string | null) => void; + onChange: (value: string | null) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -12,7 +12,7 @@ type FormDateFieldInputProps = { export const FormDateFieldInput = ({ label, defaultValue, - onPersist, + onChange, VariablePicker, readonly, }: FormDateFieldInputProps) => { @@ -21,7 +21,7 @@ export const FormDateFieldInput = ({ dateOnly label={label} defaultValue={defaultValue} - onPersist={onPersist} + onChange={onChange} VariablePicker={VariablePicker} readonly={readonly} /> diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx index 48df5df53..e95ba1c33 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx @@ -79,7 +79,7 @@ type FormDateTimeFieldInputProps = { label?: string; placeholder?: string; defaultValue: string | undefined; - onPersist: (value: string | null) => void; + onChange: (value: string | null) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -88,7 +88,7 @@ export const FormDateTimeFieldInput = ({ dateOnly, label, defaultValue, - onPersist, + onChange, VariablePicker, readonly, }: FormDateTimeFieldInputProps) => { @@ -130,11 +130,11 @@ export const FormDateTimeFieldInput = ({ const persistDate = (newDate: Nullable) => { if (!isDefined(newDate)) { - onPersist(null); + onChange(null); } else { const newDateISO = newDate.toISOString(); - onPersist(newDateISO); + onChange(newDateISO); } }; @@ -312,7 +312,7 @@ export const FormDateTimeFieldInput = ({ setInputDateTime(''); - onPersist(variableName); + onChange(variableName); }; const handleUnlinkVariable = () => { @@ -324,7 +324,7 @@ export const FormDateTimeFieldInput = ({ setPickerDate(null); - onPersist(null); + onChange(null); }; return ( diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormEmailsFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormEmailsFieldInput.tsx index 479792c23..9c6973bc8 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormEmailsFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormEmailsFieldInput.tsx @@ -8,7 +8,7 @@ import { InputLabel } from '@/ui/input/components/InputLabel'; type FormEmailsFieldInputProps = { label?: string; defaultValue?: FieldEmailsValue; - onPersist: (value: FieldEmailsValue) => void; + onChange: (value: FieldEmailsValue) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -16,12 +16,12 @@ type FormEmailsFieldInputProps = { export const FormEmailsFieldInput = ({ label, defaultValue, - onPersist, + onChange, readonly, VariablePicker, }: FormEmailsFieldInputProps) => { const handleChange = (email: string) => { - onPersist({ + onChange({ primaryEmail: email, additionalEmails: [], }); @@ -34,7 +34,7 @@ export const FormEmailsFieldInput = ({ void; + onChange: (value: FieldFullNameValue) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -18,19 +18,19 @@ type FormFullNameFieldInputProps = { export const FormFullNameFieldInput = ({ label, defaultValue, - onPersist, + onChange, readonly, VariablePicker, }: FormFullNameFieldInputProps) => { const handleFirstNameChange = (newText: string) => { - onPersist({ + onChange({ lastName: defaultValue?.lastName ?? '', firstName: newText, }); }; const handleLastNameChange = (newText: string) => { - onPersist({ + onChange({ firstName: defaultValue?.firstName ?? '', lastName: newText, }); @@ -43,7 +43,7 @@ export const FormFullNameFieldInput = ({ void; + onChange: (value: FieldLinksValue) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -17,7 +17,7 @@ type FormLinksFieldInputProps = { export const FormLinksFieldInput = ({ label, defaultValue, - onPersist, + onChange, readonly, VariablePicker, }: FormLinksFieldInputProps) => { @@ -29,7 +29,7 @@ export const FormLinksFieldInput = ({ [field]: updatedLinksPart, }; // We need to validate the links and display an error message if the links are not valid - onPersist(updatedLinks); + onChange(updatedLinks); }; return ( @@ -39,7 +39,7 @@ export const FormLinksFieldInput = ({ void; + onChange: (value: FieldMultiSelectValue | string) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; placeholder?: string; @@ -66,7 +66,7 @@ export const FormMultiSelectFieldInput = ({ label, defaultValue, options, - onPersist, + onChange, VariablePicker, readonly, placeholder, @@ -132,7 +132,7 @@ export const FormMultiSelectFieldInput = ({ editingMode: 'edit', }); - onPersist(value); + onChange(value); }; const onCancel = () => { @@ -154,7 +154,7 @@ export const FormMultiSelectFieldInput = ({ value: variableName, }); - onPersist(variableName); + onChange(variableName); }; const handleUnlinkVariable = () => { @@ -164,7 +164,7 @@ export const FormMultiSelectFieldInput = ({ editingMode: 'view', }); - onPersist([]); + onChange([]); }; const selectedNames = diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx index 8e72ea6a2..814eeea33 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx @@ -4,6 +4,8 @@ import { FormFieldInputRowContainer } from '@/object-record/record-field/form-ty import { VariableChipStandalone } from '@/object-record/record-field/form-types/components/VariableChipStandalone'; import { VariablePickerComponent } from '@/object-record/record-field/form-types/types/VariablePickerComponent'; import { TextInput } from '@/ui/field/input/components/TextInput'; +import { InputErrorHelper } from '@/ui/input/components/InputErrorHelper'; +import { InputHint } from '@/ui/input/components/InputHint'; import { InputLabel } from '@/ui/input/components/InputLabel'; import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString'; import styled from '@emotion/styled'; @@ -13,8 +15,6 @@ import { canBeCastAsNumberOrNull, castAsNumberOrNull, } from '~/utils/cast-as-number-or-null'; -import { InputErrorHelper } from '@/ui/input/components/InputErrorHelper'; -import { InputHint } from '@/ui/input/components/InputHint'; const StyledInput = styled(TextInput)` padding: ${({ theme }) => `${theme.spacing(1)} ${theme.spacing(2)}`}; @@ -25,7 +25,7 @@ type FormNumberFieldInputProps = { error?: string; placeholder: string; defaultValue: number | string | undefined; - onPersist: (value: number | null | string) => void; + onChange: (value: number | null | string) => void; onBlur?: () => void; VariablePicker?: VariablePickerComponent; hint?: string; @@ -37,7 +37,7 @@ export const FormNumberFieldInput = ({ error, placeholder, defaultValue, - onPersist, + onChange, onBlur, VariablePicker, hint, @@ -73,7 +73,7 @@ export const FormNumberFieldInput = ({ const castedValue = castAsNumberOrNull(newValue); - onPersist(castedValue); + onChange(castedValue); }; const handleChange = (newText: string) => { @@ -91,7 +91,7 @@ export const FormNumberFieldInput = ({ value: '', }); - onPersist(null); + onChange(null); }; const handleVariableTagInsert = (variableName: string) => { @@ -100,7 +100,7 @@ export const FormNumberFieldInput = ({ value: variableName, }); - onPersist(variableName); + onChange(variableName); }; return ( diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormPhoneFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormPhoneFieldInput.tsx index 16ce72255..f07e38ae7 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormPhoneFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormPhoneFieldInput.tsx @@ -13,7 +13,7 @@ import { getCountryCallingCode } from 'libphonenumber-js'; type FormPhoneFieldInputProps = { label?: string; defaultValue?: FieldPhonesValue; - onPersist: (value: FieldPhonesValue) => void; + onChange: (value: FieldPhonesValue) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -21,7 +21,7 @@ type FormPhoneFieldInputProps = { export const FormPhoneFieldInput = ({ label, defaultValue, - onPersist, + onChange, readonly, VariablePicker, }: FormPhoneFieldInputProps) => { @@ -35,7 +35,7 @@ export const FormPhoneFieldInput = ({ newCallingCode = getCountryCallingCode(newCountry); } - onPersist({ + onChange({ primaryPhoneCountryCode: newCountry, primaryPhoneCallingCode: newCallingCode, primaryPhoneNumber: defaultValue?.primaryPhoneNumber ?? '', @@ -43,7 +43,7 @@ export const FormPhoneFieldInput = ({ }; const handleNumberChange = (number: string | number | null) => { - onPersist({ + onChange({ primaryPhoneCountryCode: defaultValue?.primaryPhoneCountryCode ?? '', primaryPhoneCallingCode: defaultValue?.primaryPhoneCallingCode ?? '', primaryPhoneNumber: number ? `${number}` : '', @@ -56,13 +56,13 @@ export const FormPhoneFieldInput = ({ void; + onChange: (value: string | null) => void; readonly?: boolean; VariablePicker?: VariablePickerComponent; }; @@ -22,7 +22,7 @@ export const FormRawJsonFieldInput = ({ label, defaultValue, placeholder, - onPersist, + onChange, readonly, VariablePicker, }: FormRawJsonFieldInputProps) => { @@ -37,12 +37,12 @@ export const FormRawJsonFieldInput = ({ const text = turnIntoEmptyStringIfWhitespacesOnly(editor.getText()); if (text === '') { - onPersist(null); + onChange(null); return; } - onPersist(text); + onChange(text); }, }); diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx index ee4bc0b34..d9a746f29 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx @@ -24,7 +24,7 @@ import { IconChevronDown, VisibilityHidden } from 'twenty-ui'; type FormSelectFieldInputProps = { label?: string; defaultValue: string | undefined; - onPersist: (value: string | null) => void; + onChange: (value: string | null) => void; VariablePicker?: VariablePickerComponent; options: SelectOption[]; clearLabel?: string; @@ -72,7 +72,7 @@ const StyledSelectDisplayContainer = styled.div` export const FormSelectFieldInput = ({ label, defaultValue, - onPersist, + onChange, VariablePicker, options, clearLabel, @@ -122,7 +122,7 @@ export const FormSelectFieldInput = ({ goBackToPreviousHotkeyScope(); - onPersist(option); + onChange(option); }; const onCancel = () => { @@ -151,7 +151,7 @@ export const FormSelectFieldInput = ({ value: '', }); - onPersist(null); + onChange(null); }; const selectedOption = options.find( @@ -177,7 +177,7 @@ export const FormSelectFieldInput = ({ editingMode: 'view', }); - onPersist(null); + onChange(null); }; const handleVariableTagInsert = (variableName: string) => { @@ -186,7 +186,7 @@ export const FormSelectFieldInput = ({ value: variableName, }); - onPersist(variableName); + onChange(variableName); }; const handleDisplayModeClick = () => { diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormTextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormTextFieldInput.tsx index 55d5597b3..1087ada0c 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormTextFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormTextFieldInput.tsx @@ -17,7 +17,7 @@ type FormTextFieldInputProps = { hint?: string; defaultValue: string | undefined; placeholder: string; - onPersist: (value: string) => void; + onChange: (value: string) => void; onBlur?: () => void; multiline?: boolean; readonly?: boolean; @@ -30,7 +30,7 @@ export const FormTextFieldInput = ({ hint, defaultValue, placeholder, - onPersist, + onChange, onBlur, multiline, readonly, @@ -47,7 +47,7 @@ export const FormTextFieldInput = ({ const jsonContent = editor.getJSON(); const parsedContent = parseEditorContent(jsonContent); - onPersist(parsedContent); + onChange(parsedContent); }, }); diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormUuidFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormUuidFieldInput.tsx index 6d0a96a1e..9e7c36475 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormUuidFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormUuidFieldInput.tsx @@ -18,7 +18,7 @@ type FormUuidFieldInputProps = { label?: string; defaultValue: string | null | undefined; placeholder: string; - onPersist: (value: string | null) => void; + onChange: (value: string | null) => void; readonly?: boolean; VariablePicker?: VariablePickerComponent; }; @@ -27,7 +27,7 @@ export const FormUuidFieldInput = ({ label, defaultValue, placeholder, - onPersist, + onChange, readonly, VariablePicker, }: FormUuidFieldInputProps) => { @@ -63,12 +63,12 @@ export const FormUuidFieldInput = ({ const trimmedNewText = newText.trim(); if (trimmedNewText === '') { - onPersist(null); + onChange(null); return; } - onPersist(trimmedNewText); + onChange(trimmedNewText); }; const handleUnlinkVariable = () => { @@ -77,7 +77,7 @@ export const FormUuidFieldInput = ({ value: '', }); - onPersist(null); + onChange(null); }; const handleVariableTagInsert = (variableName: string) => { @@ -86,7 +86,7 @@ export const FormUuidFieldInput = ({ value: variableName, }); - onPersist(variableName); + onChange(variableName); }; return ( diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormAddressFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormAddressFieldInput.stories.tsx index 944af1885..fd48be040 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormAddressFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormAddressFieldInput.stories.tsx @@ -89,7 +89,7 @@ export const Disabled: Story = { addressLat: 39.781721, addressLng: -89.650148, }, - onPersist: fn(), + onChange: fn(), VariablePicker: () =>
VariablePicker
, }, play: async ({ canvasElement, args }) => { @@ -113,7 +113,7 @@ export const Disabled: Story = { const searchInputInModal = canvas.queryByPlaceholderText('Search'); expect(searchInputInModal).not.toBeInTheDocument(); - expect(args.onPersist).not.toHaveBeenCalled(); + expect(args.onChange).not.toHaveBeenCalled(); const variablePickers = canvas.queryAllByText('VariablePicker'); expect(variablePickers).toHaveLength(0); diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormDateFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormDateFieldInput.stories.tsx index 57b89f19c..b804e8d3d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormDateFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormDateFieldInput.stories.tsx @@ -61,7 +61,7 @@ export const SetsDateWithInput: Story = { args: { label: 'Created At', defaultValue: undefined, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -76,7 +76,7 @@ export const SetsDateWithInput: Story = { await userEvent.type(input, `12/08/${currentYear}{enter}`); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith( + expect(args.onChange).toHaveBeenCalledWith( `${currentYear}-12-08T00:00:00.000Z`, ); }); @@ -89,7 +89,7 @@ export const SetsDateWithDatePicker: Story = { args: { label: 'Created At', defaultValue: `2024-12-09T13:20:19.631Z`, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -111,7 +111,7 @@ export const SetsDateWithDatePicker: Story = { waitForElementToBeRemoved(datePicker), waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith( + expect(args.onChange).toHaveBeenCalledWith( expect.stringMatching(new RegExp(`^2024-12-07`)), ); }), @@ -126,7 +126,7 @@ export const ResetsDateByClickingButton: Story = { args: { label: 'Created At', defaultValue: `${currentYear}-12-09T13:20:19.631Z`, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -146,7 +146,7 @@ export const ResetsDateByClickingButton: Story = { waitForElementToBeRemoved(datePicker), waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(null); + expect(args.onChange).toHaveBeenCalledWith(null); }), waitFor(() => { expect(input).toHaveDisplayValue(''); @@ -159,7 +159,7 @@ export const ResetsDateByErasingInputContent: Story = { args: { label: 'Created At', defaultValue: `${currentYear}-12-09T13:20:19.631Z`, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -176,7 +176,7 @@ export const ResetsDateByErasingInputContent: Story = { waitForElementToBeRemoved(() => canvas.queryByRole('dialog')), waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(null); + expect(args.onChange).toHaveBeenCalledWith(null); }), waitFor(() => { expect(input).toHaveDisplayValue(''); @@ -189,7 +189,7 @@ export const DefaultsToMinValueWhenTypingReallyOldDate: Story = { args: { label: 'Created At', defaultValue: undefined, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -206,7 +206,7 @@ export const DefaultsToMinValueWhenTypingReallyOldDate: Story = { userEvent.type(input, '02/02/1500{Enter}'), waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(MIN_DATE.toISOString()); + expect(args.onChange).toHaveBeenCalledWith(MIN_DATE.toISOString()); }), waitFor(() => { expect(input).toHaveDisplayValue( @@ -247,7 +247,7 @@ export const DefaultsToMaxValueWhenTypingReallyFarDate: Story = { args: { label: 'Created At', defaultValue: undefined, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -264,7 +264,7 @@ export const DefaultsToMaxValueWhenTypingReallyFarDate: Story = { userEvent.type(input, '02/02/2500{Enter}'), waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(MAX_DATE.toISOString()); + expect(args.onChange).toHaveBeenCalledWith(MAX_DATE.toISOString()); }), waitFor(() => { expect(input).toHaveDisplayValue( @@ -305,7 +305,7 @@ export const SwitchesToStandaloneVariable: Story = { args: { label: 'Created At', defaultValue: undefined, - onPersist: fn(), + onChange: fn(), VariablePicker: ({ onVariableSelect }) => { return ( ); }, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -167,7 +167,7 @@ export const SelectingVariables: Story = { expect(phoneNumberVariable).toBeVisible(); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith({ + expect(args.onChange).toHaveBeenCalledWith({ primaryPhoneNumber: `{{${MOCKED_STEP_ID}.phone.number}}`, primaryPhoneCountryCode: '', primaryPhoneCallingCode: '', diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormRawJsonFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormRawJsonFieldInput.stories.tsx index 97e1dbee0..c10877175 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormRawJsonFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormRawJsonFieldInput.stories.tsx @@ -36,7 +36,7 @@ export const Readonly: Story = { label: 'JSON field', placeholder: 'Enter valid json', readonly: true, - onPersist: fn(), + onChange: fn(), VariablePicker: ({ onVariableSelect }) => { return ( ); }, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -213,7 +213,7 @@ export const InsertVariableInTheMiddleOnTextInput: Story = { await Promise.all([ waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith( + expect(args.onChange).toHaveBeenCalledWith( '{ "a": { "b" : {{test}} } }', ); }), @@ -235,7 +235,7 @@ export const CanUseVariableAsObjectProperty: Story = { ); }, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -257,7 +257,7 @@ export const CanUseVariableAsObjectProperty: Story = { await userEvent.type(editor, '": 2 }'); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith('{ "{{test}}": 2 }'); + expect(args.onChange).toHaveBeenCalledWith('{ "{{test}}": 2 }'); }); }, }; @@ -266,7 +266,7 @@ export const ClearField: Story = { args: { placeholder: 'Enter valid json', defaultValue: '{ "a": 2 }', - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const defaultValueStringLength = args.defaultValue!.length; @@ -281,7 +281,7 @@ export const ClearField: Story = { userEvent.type(editor, `{Backspace>${defaultValueStringLength}}`), waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(null); + expect(args.onChange).toHaveBeenCalledWith(null); }), ]); }, @@ -294,7 +294,7 @@ export const ClearField: Story = { export const DoesNotBreakWhenUserInsertsNewlineInJsonString: Story = { args: { placeholder: 'Enter valid json', - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const editor = await waitFor(() => { @@ -307,14 +307,14 @@ export const DoesNotBreakWhenUserInsertsNewlineInJsonString: Story = { await userEvent.click(canvasElement); - expect(args.onPersist).toHaveBeenCalled(); + expect(args.onChange).toHaveBeenCalled(); }, }; export const AcceptsJsonEncodedNewline: Story = { args: { placeholder: 'Enter valid json', - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const editor = await waitFor(() => { @@ -327,7 +327,7 @@ export const AcceptsJsonEncodedNewline: Story = { await userEvent.click(canvasElement); - expect(args.onPersist).toHaveBeenCalledWith('"a\\nb"'); + expect(args.onChange).toHaveBeenCalledWith('"a\\nb"'); }, }; @@ -345,7 +345,7 @@ export const HasHistory: Story = { ); }, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const controlKey = getUserDevice() === 'mac' ? 'Meta' : 'Control'; @@ -368,14 +368,14 @@ export const HasHistory: Story = { await userEvent.type(editor, ' }'); - expect(args.onPersist).toHaveBeenLastCalledWith( + expect(args.onChange).toHaveBeenLastCalledWith( `{ "a": {{${MOCKED_STEP_ID}.name}} }`, ); await userEvent.type(editor, `{${controlKey}>}z{/${controlKey}}`); expect(editor).toHaveTextContent(''); - expect(args.onPersist).toHaveBeenLastCalledWith(null); + expect(args.onChange).toHaveBeenLastCalledWith(null); await userEvent.type( editor, @@ -383,7 +383,7 @@ export const HasHistory: Story = { ); expect(editor).toHaveTextContent('{ "a": Name }'); - expect(args.onPersist).toHaveBeenLastCalledWith( + expect(args.onChange).toHaveBeenLastCalledWith( `{ "a": {{${MOCKED_STEP_ID}.name}} }`, ); }, diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormSelectFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormSelectFieldInput.stories.tsx index 5b1ed4a90..58bb5abaf 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormSelectFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormSelectFieldInput.stories.tsx @@ -65,7 +65,7 @@ export const WithVariablePicker: Story = { color: 'blue', }, ], - onPersist: fn(), + onChange: fn(), VariablePicker: () =>
VariablePicker
, }, play: async ({ canvasElement }) => { @@ -102,7 +102,7 @@ export const Disabled: Story = { color: 'yellow', }, ], - onPersist: fn(), + onChange: fn(), readonly: true, }, play: async ({ canvasElement }) => { @@ -144,7 +144,7 @@ export const DisabledWithVariable: Story = { color: 'yellow', }, ], - onPersist: fn(), + onChange: fn(), readonly: true, }, play: async ({ canvasElement }) => { diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormTextFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormTextFieldInput.stories.tsx index 9c2f2d6e3..c619505b3 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormTextFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormTextFieldInput.stories.tsx @@ -89,7 +89,7 @@ export const WithVariable: Story = { ); }, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -104,9 +104,9 @@ export const WithVariable: Story = { expect(variable).toBeVisible(); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(`{{${MOCKED_STEP_ID}.name}}`); + expect(args.onChange).toHaveBeenCalledWith(`{{${MOCKED_STEP_ID}.name}}`); }); - expect(args.onPersist).toHaveBeenCalledTimes(1); + expect(args.onChange).toHaveBeenCalledTimes(1); }, }; @@ -115,7 +115,7 @@ export const WithDeletableVariable: Story = { label: 'Text', placeholder: 'Text field...', defaultValue: `test {{${MOCKED_STEP_ID}.name}} test`, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -143,9 +143,9 @@ export const WithDeletableVariable: Story = { expect(editor).toHaveTextContent('test test'); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith('test test'); + expect(args.onChange).toHaveBeenCalledWith('test test'); }); - expect(args.onPersist).toHaveBeenCalledTimes(1); + expect(args.onChange).toHaveBeenCalledTimes(1); }, }; @@ -156,7 +156,7 @@ export const Disabled: Story = { defaultValue: 'Text field', readonly: true, VariablePicker: () =>
VariablePicker
, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -175,7 +175,7 @@ export const Disabled: Story = { await userEvent.type(editor, 'Hello'); - expect(args.onPersist).not.toHaveBeenCalled(); + expect(args.onChange).not.toHaveBeenCalled(); expect(canvas.queryByText('Hello')).not.toBeInTheDocument(); expect(defaultValue).toBeVisible(); }, @@ -220,7 +220,7 @@ export const HasHistory: Story = { ); }, - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const controlKey = getUserDevice() === 'mac' ? 'Meta' : 'Control'; @@ -241,14 +241,14 @@ export const HasHistory: Story = { await userEvent.click(addVariableButton); - expect(args.onPersist).toHaveBeenLastCalledWith( + expect(args.onChange).toHaveBeenLastCalledWith( `Hello World {{${MOCKED_STEP_ID}.name}}`, ); await userEvent.type(editor, `{${controlKey}>}z{/${controlKey}}`); expect(editor).toHaveTextContent(''); - expect(args.onPersist).toHaveBeenLastCalledWith(''); + expect(args.onChange).toHaveBeenLastCalledWith(''); await userEvent.type( editor, @@ -256,7 +256,7 @@ export const HasHistory: Story = { ); expect(editor).toHaveTextContent(`Hello World Name`); - expect(args.onPersist).toHaveBeenLastCalledWith( + expect(args.onChange).toHaveBeenLastCalledWith( `Hello World {{${MOCKED_STEP_ID}.name}}`, ); }, diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormUuidFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormUuidFieldInput.stories.tsx index fe69a64db..9c8f0ca0a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormUuidFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/__stories__/FormUuidFieldInput.stories.tsx @@ -33,7 +33,7 @@ export const SetUuidWithDashes: Story = { args: { label: 'UUID field', placeholder: 'Enter UUID', - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -46,7 +46,7 @@ export const SetUuidWithDashes: Story = { await userEvent.type(input, uuid); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(uuid); + expect(args.onChange).toHaveBeenCalledWith(uuid); }); }, }; @@ -55,7 +55,7 @@ export const SetUuidWithoutDashes: Story = { args: { label: 'UUID field', placeholder: 'Enter UUID', - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -68,7 +68,7 @@ export const SetUuidWithoutDashes: Story = { await userEvent.type(input, uuid); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(uuid); + expect(args.onChange).toHaveBeenCalledWith(uuid); }); }, }; @@ -77,7 +77,7 @@ export const SetInvalidUuidWithNoValidation: Story = { args: { label: 'UUID field', placeholder: 'Enter UUID', - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -90,7 +90,7 @@ export const SetInvalidUuidWithNoValidation: Story = { await userEvent.type(input, uuid); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(uuid); + expect(args.onChange).toHaveBeenCalledWith(uuid); }); }, }; @@ -99,7 +99,7 @@ export const TrimInputBeforePersisting: Story = { args: { label: 'UUID field', placeholder: 'Enter UUID', - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -112,7 +112,7 @@ export const TrimInputBeforePersisting: Story = { await userEvent.type(input, `{Space>2}${uuid}{Space>3}`); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(uuid); + expect(args.onChange).toHaveBeenCalledWith(uuid); }); }, }; @@ -121,7 +121,7 @@ export const ClearField: Story = { args: { label: 'UUID field', placeholder: 'Enter UUID', - onPersist: fn(), + onChange: fn(), }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); @@ -134,14 +134,14 @@ export const ClearField: Story = { await userEvent.type(input, uuid); await waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(uuid); + expect(args.onChange).toHaveBeenCalledWith(uuid); }); await Promise.all([ userEvent.clear(input), waitFor(() => { - expect(args.onPersist).toHaveBeenCalledWith(null); + expect(args.onChange).toHaveBeenCalledWith(null); }), ]); }, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateRecord.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateRecord.tsx index 1d3390a85..9c4dd57d2 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateRecord.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateRecord.tsx @@ -210,7 +210,7 @@ export const WorkflowEditActionCreateRecord = ({ key={field.metadata.fieldName} defaultValue={currentValue} field={field} - onPersist={(value) => { + onChange={(value) => { handleFieldChange(field.metadata.fieldName, value); }} VariablePicker={WorkflowVariablePicker} diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionFindRecords.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionFindRecords.tsx index 394136f52..7f9df87bf 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionFindRecords.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionFindRecords.tsx @@ -138,7 +138,7 @@ export const WorkflowEditActionFindRecords = ({ label="Limit" defaultValue={formData.limit} placeholder="Enter limit" - onPersist={() => {}} + onChange={() => {}} readonly /> diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionSendEmail.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionSendEmail.tsx index f6db50e71..cd5e99ab9 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionSendEmail.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionSendEmail.tsx @@ -240,7 +240,7 @@ export const WorkflowEditActionSendEmail = ({ placeholder="Enter receiver email" readonly={actionOptions.readonly} defaultValue={formData.email} - onPersist={(email) => { + onChange={(email) => { handleFieldChange('email', email); }} VariablePicker={WorkflowVariablePicker} @@ -250,7 +250,7 @@ export const WorkflowEditActionSendEmail = ({ placeholder="Enter email subject" readonly={actionOptions.readonly} defaultValue={formData.subject} - onPersist={(subject) => { + onChange={(subject) => { handleFieldChange('subject', subject); }} VariablePicker={WorkflowVariablePicker} @@ -260,7 +260,7 @@ export const WorkflowEditActionSendEmail = ({ placeholder="Enter email body" readonly={actionOptions.readonly} defaultValue={formData.body} - onPersist={(body) => { + onChange={(body) => { handleFieldChange('body', body); }} VariablePicker={WorkflowVariablePicker} diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionServerlessFunctionFields.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionServerlessFunctionFields.tsx index 338a0ceec..f357e13af 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionServerlessFunctionFields.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionServerlessFunctionFields.tsx @@ -56,7 +56,7 @@ export const WorkflowEditActionServerlessFunctionFields = ({ placeholder="Enter value" defaultValue={inputValue ? `${inputValue}` : ''} readonly={readonly} - onPersist={(value) => onInputChange?.(value, currentPath)} + onChange={(value) => onInputChange?.(value, currentPath)} VariablePicker={VariablePicker} /> ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpdateRecord.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpdateRecord.tsx index 8156255d4..7fe82bab3 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpdateRecord.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpdateRecord.tsx @@ -227,7 +227,7 @@ export const WorkflowEditActionUpdateRecord = ({ icon: getIcon(field.iconName), color: 'gray', }))} - onPersist={(fieldsToUpdate) => + onChange={(fieldsToUpdate) => handleFieldChange('fieldsToUpdate', fieldsToUpdate) } placeholder="Select fields to update" @@ -254,7 +254,7 @@ export const WorkflowEditActionUpdateRecord = ({ key={fieldDefinition.metadata.fieldName} defaultValue={currentValue} field={fieldDefinition} - onPersist={(value) => { + onChange={(value) => { handleFieldChange(fieldDefinition.metadata.fieldName, value); }} VariablePicker={WorkflowVariablePicker} diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx index b0345c958..af2ccba48 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx @@ -109,7 +109,7 @@ export const WorkflowEditActionFormFieldSettings = ({ icon: IllustrationIconNumbers, }, ]} - onPersist={(newType: string | null) => { + onChange={(newType: string | null) => { if (newType === null) { return; } diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx index 834eba71c..0458aa44a 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx @@ -26,7 +26,7 @@ export const WorkflowFormFieldSettingsNumber = ({ Label { + onChange={(newLabel: string | null) => { onChange('label', newLabel); }} defaultValue={label ?? t`Number`} @@ -36,7 +36,7 @@ export const WorkflowFormFieldSettingsNumber = ({ Placeholder { + onChange={(newPlaceholder: string | null) => { onChange('placeholder', newPlaceholder); }} defaultValue={placeholder ?? '1000'} diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx index 109106fdf..f19cfaa8c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx @@ -25,7 +25,7 @@ export const WorkflowFormFieldSettingsText = ({ Label { + onChange={(newLabel: string | null) => { onChange('label', newLabel); }} defaultValue={label} @@ -35,7 +35,7 @@ export const WorkflowFormFieldSettingsText = ({ Placeholder { + onChange={(newPlaceholder: string | null) => { onChange('placeholder', newPlaceholder); }} defaultValue={placeholder} diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx index 6200621d9..99a54b29d 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx @@ -117,7 +117,7 @@ export const WorkflowEditTriggerCronForm = ({ hint="Format: [Minute] [Hour] [Day of Month] [Month] [Day of Week]" readonly={triggerOptions.readonly} defaultValue={trigger.settings.pattern} - onPersist={(newPattern: string) => { + onChange={(newPattern: string) => { if (triggerOptions.readonly === true) { return; } @@ -156,7 +156,7 @@ export const WorkflowEditTriggerCronForm = ({ error={errorMessagesVisible ? errorMessages.DAYS_day : undefined} onBlur={onBlur} defaultValue={trigger.settings.schedule.day} - onPersist={(newDay) => { + onChange={(newDay) => { if (triggerOptions.readonly === true) { return; } @@ -205,7 +205,7 @@ export const WorkflowEditTriggerCronForm = ({ error={errorMessagesVisible ? errorMessages.DAYS_hour : undefined} onBlur={onBlur} defaultValue={trigger.settings.schedule.hour} - onPersist={(newHour) => { + onChange={(newHour) => { if (triggerOptions.readonly === true) { return; } @@ -256,7 +256,7 @@ export const WorkflowEditTriggerCronForm = ({ } onBlur={onBlur} defaultValue={trigger.settings.schedule.minute} - onPersist={(newMinute) => { + onChange={(newMinute) => { if (triggerOptions.readonly === true) { return; } @@ -311,7 +311,7 @@ export const WorkflowEditTriggerCronForm = ({ } onBlur={onBlur} defaultValue={trigger.settings.schedule.hour} - onPersist={(newHour) => { + onChange={(newHour) => { if (triggerOptions.readonly === true) { return; } @@ -358,7 +358,7 @@ export const WorkflowEditTriggerCronForm = ({ } onBlur={onBlur} defaultValue={trigger.settings.schedule.minute} - onPersist={(newMinute) => { + onChange={(newMinute) => { if (triggerOptions.readonly === true) { return; } @@ -406,7 +406,7 @@ export const WorkflowEditTriggerCronForm = ({ error={errorMessagesVisible ? errorMessages.MINUTES : undefined} onBlur={onBlur} defaultValue={trigger.settings.schedule.minute} - onPersist={(newMinute) => { + onChange={(newMinute) => { if (triggerOptions.readonly === true) { return; }