From 7c3791a0988b944c6ce2057e725ee2dbcc95a2bb Mon Sep 17 00:00:00 2001 From: Devessier Date: Thu, 21 Nov 2024 12:00:38 +0100 Subject: [PATCH] refactor: make all event listeners optional --- .../meta-types/input/hooks/useRegisterInputEvents.ts | 4 ++-- .../src/modules/ui/field/input/components/TextInput.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents.ts index c4ce8f03a7..8e41832d22 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents.ts @@ -18,8 +18,8 @@ export const useRegisterInputEvents = ({ inputRef: React.RefObject; copyRef?: React.RefObject; inputValue: T; - onEscape: (inputValue: T) => void; - onEnter: (inputValue: T) => void; + onEscape?: (inputValue: T) => void; + onEnter?: (inputValue: T) => void; onTab?: (inputValue: T) => void; onShiftTab?: (inputValue: T) => void; onClickOutside?: (event: MouseEvent | TouchEvent, inputValue: T) => void; diff --git a/packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx index b932cbdc5f..1ca01f5b4f 100644 --- a/packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx +++ b/packages/twenty-front/src/modules/ui/field/input/components/TextInput.tsx @@ -15,11 +15,11 @@ type TextInputProps = { placeholder?: string; autoFocus?: boolean; value: string; - onEnter: (newText: string) => void; - onEscape: (newText: string) => void; + onEnter?: (newText: string) => void; + onEscape?: (newText: string) => void; onTab?: (newText: string) => void; onShiftTab?: (newText: string) => void; - onClickOutside: (event: MouseEvent | TouchEvent, inputValue: string) => void; + onClickOutside?: (event: MouseEvent | TouchEvent, inputValue: string) => void; hotkeyScope: string; onChange?: (newText: string) => void; copyButton?: boolean;