Skip to content

The open alternative to Salesforce, designed for AI.

Leave table focus on show page click (#3521)

Lucas Bordeau9ebc0deaafea
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 59e76fc0089..534bbbd35de 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;
}