From 9ebc0deaafea83e832714f0eca1591fd12c9d7b0 Mon Sep 17 00:00:00 2001 From: Lucas Bordeau Date: Tue, 23 Jan 2024 17:57:44 +0100 Subject: [PATCH] Leave table focus on show page click (#3521) --- .../record-table/record-table-cell/hooks/useTableCell.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTableCell.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTableCell.ts index 59e76fc00..534bbbd35 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTableCell.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTableCell.ts @@ -9,6 +9,7 @@ import { entityFieldInitialValueFamilyState } from '@/object-record/field/states import { FieldInitialValue } from '@/object-record/field/types/FieldInitialValue'; import { EntityDeleteContext } from '@/object-record/record-table/contexts/EntityDeleteHookContext'; import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates'; +import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable'; import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect'; import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope'; import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope'; @@ -29,6 +30,8 @@ export const useTableCell = () => { const { getObjectMetadataConfigState, getTableRowIdsState } = useRecordTableStates(); + const { leaveTableFocus } = useRecordTable(); + const objectMetadataConfig = useRecoilValue(getObjectMetadataConfigState()); const basePathToShowPage = objectMetadataConfig?.basePathToShowPage; @@ -67,6 +70,7 @@ export const useTableCell = () => { const openTableCell = (options?: { initialValue?: FieldInitialValue }) => { if (isFirstColumnCell && !isEmpty && basePathToShowPage) { + leaveTableFocus(); navigate(`${basePathToShowPage}${entityId}`); return; }