fix: read only cells flash on click (#8057)

Fix for https://github.com/twentyhq/twenty/issues/6807
This commit is contained in:
pau-not-paul
2024-10-25 17:00:52 +02:00
committed by GitHub
parent 9c923ba8d5
commit 016642a940

View File

@@ -1,6 +1,7 @@
import { useContext } from 'react';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly';
import { FieldDefinition } from '@/object-record/record-field/types/FieldDefinition';
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
import { CellHotkeyScopeContext } from '@/object-record/record-table/contexts/CellHotkeyScopeContext';
@@ -34,6 +35,8 @@ export const useOpenRecordTableCellFromCell = () => {
const { isReadOnly, pathToShowPage, objectNameSingular } = useContext(
RecordTableRowContext,
);
const isFieldReadOnly = useIsFieldReadOnly();
const cellIsReadOnly = isReadOnly || isFieldReadOnly;
const openTableCell = (
initialValue?: string,
@@ -44,7 +47,7 @@ export const useOpenRecordTableCellFromCell = () => {
customCellHotkeyScope,
recordId,
fieldDefinition,
isReadOnly,
isReadOnly: cellIsReadOnly,
pathToShowPage,
objectNameSingular,
initialValue,