From 4b45350430a83b17571531a3e5068b8f6bb9aa26 Mon Sep 17 00:00:00 2001 From: Manikanth Martha <117458699+ManikanthMartha@users.noreply.github.com> Date: Sat, 18 Oct 2025 17:55:39 +0530 Subject: [PATCH] Add timestamps to GQL fields in useRecordsFieldVisibleGqlFields hook (#15185) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes #15156 Issue: Restore and Destroy buttons not appearing in action menu for deleted records until the record detail view is opened. Cause: The record index/table view queries only fetched fields that were visible as table columns The [deletedAt] field (along with [createdAt] and [updatedAt]) was not included in these queries since it's not a visible column The action menu logic checks [selectedRecord?.deletedAt] to determine if a record is deleted and which actions to display Without the [deletedAt] field in the record store, the action menu couldn't detect deleted records Opening the detailed view would fetch all fields (including [deletedAt]), which is why the buttons would appear afterward Solution Modified [useRecordsFieldVisibleGqlFields] to always include the standard fields ([createdAt], [updatedAt], [deletedAt]) in record index queries, regardless of column visibility. This ensures the action menu can immediately detect deleted records --------- Co-authored-by: Félix Malfait Co-authored-by: Félix Malfait --- .github/workflows/ci-front.yaml | 2 +- .../hooks/__tests__/useRecordIndexTableQuery.test.tsx | 3 +++ .../record-field/hooks/useRecordsFieldVisibleGqlFields.ts | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-front.yaml b/.github/workflows/ci-front.yaml index fa0e2562d5..c0a315dfae 100644 --- a/.github/workflows/ci-front.yaml +++ b/.github/workflows/ci-front.yaml @@ -141,7 +141,7 @@ jobs: cd packages/twenty-front touch .env echo "" >> .env - echo "REACT_APP_SERVER_BASE_URL: $REACT_APP_SERVER_BASE_URL" >> .env + echo "REACT_APP_SERVER_BASE_URL=$REACT_APP_SERVER_BASE_URL" >> .env - name: Publish to Chromatic run: npx nx run twenty-front:chromatic:ci front-task: diff --git a/packages/twenty-front/src/modules/object-record/hooks/__tests__/useRecordIndexTableQuery.test.tsx b/packages/twenty-front/src/modules/object-record/hooks/__tests__/useRecordIndexTableQuery.test.tsx index a9f26646c1..abd528709b 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/__tests__/useRecordIndexTableQuery.test.tsx +++ b/packages/twenty-front/src/modules/object-record/hooks/__tests__/useRecordIndexTableQuery.test.tsx @@ -48,6 +48,8 @@ const mocks: MockedResponse[] = [ node { __typename avatarUrl + createdAt + deletedAt id name { firstName @@ -178,6 +180,7 @@ const mocks: MockedResponse[] = [ } } } + updatedAt } cursor } diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts index 9601d64ede..73f09b6628 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts @@ -72,6 +72,9 @@ export const useRecordsFieldVisibleGqlFields = ({ : {}), ...(hasPosition ? { position: true } : {}), ...allDepthOneGqlFields, + createdAt: true, + updatedAt: true, + deletedAt: true, noteTargets: generateDepthRecordGqlFieldsFromObject({ objectMetadataItem: noteTargetObjectMetadataItem, objectMetadataItems,