From ad9fa9de57390d7b70e876f6decc60e1375fc93d Mon Sep 17 00:00:00 2001
From: Pau <pvidalbordoy@gmail.com>
Date: Fri, 25 Oct 2024 12:47:48 +0200
Subject: [PATCH] fix: read only cells flash on click

---
 .../hooks/useOpenRecordTableCellFromCell.ts                  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell.ts
index 6c3bd3d90ece..002d638cf221 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell.ts
@@ -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,