Leave table focus on show page click (#3521)

This commit is contained in:
Lucas Bordeau
2024-01-23 13:57:44 -03:00
committed by GitHub
parent aa603f1ff4
commit 9ebc0deaaf
@@ -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;
}