From f3857c41b8e2b90f11ce50e3e102aa01047aac80 Mon Sep 17 00:00:00 2001 From: nitin <142569587+ehconitin@users.noreply.github.com> Date: Wed, 25 Feb 2026 18:25:41 +0530 Subject: [PATCH] fix dashboard duplicate (#18193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes https://github.com/twentyhq/twenty/issues/18192 what was broken - wrong client before - https://github.com/user-attachments/assets/1da60e07-622c-4884-b5bb-9eb7fc954782 after - https://github.com/user-attachments/assets/fcf299f0-2515-410b-ad60-738c4b3dc322 --------- Co-authored-by: Raphaƫl Bosi <71827178+bosiraphael@users.noreply.github.com> --- .../constants/DashboardActionsConfig.tsx | 1 - .../dashboards/hooks/useDuplicateDashboard.ts | 22 ++----------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DashboardActionsConfig.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DashboardActionsConfig.tsx index 742310e2566..608550202d1 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DashboardActionsConfig.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/constants/DashboardActionsConfig.tsx @@ -90,7 +90,6 @@ export const DASHBOARD_ACTIONS_CONFIG = inheritActionsFromDefaultConfig({ isDefined(selectedRecord) && !selectedRecord?.isRemote && !isDefined(selectedRecord?.deletedAt) && - isDefined(selectedRecord?.pageLayoutId) && objectPermissions.canUpdateObjectRecords, availableOn: [ ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION, diff --git a/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts b/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts index 5853e6bdb4b..bed3357108f 100644 --- a/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts +++ b/packages/twenty-front/src/modules/dashboards/hooks/useDuplicateDashboard.ts @@ -1,6 +1,4 @@ import { triggerCreateRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerCreateRecordsOptimisticEffect'; -import { DUPLICATE_DASHBOARD } from '@/dashboards/graphql/mutations/duplicateDashboard'; -import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; @@ -10,21 +8,10 @@ import { getRecordNodeFromRecord } from '@/object-record/cache/utils/getRecordNo import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useMutation } from '@apollo/client'; import { isDefined } from 'twenty-shared/utils'; - -type DuplicateDashboardResult = { - id: string; - title: string | null; - pageLayoutId: string | null; - position: number; - createdAt: string; - updatedAt: string; -}; +import { useDuplicateDashboardMutation } from '~/generated-metadata/graphql'; export const useDuplicateDashboard = () => { - const apolloCoreClient = useApolloCoreClient(); - const { objectMetadataItem } = useObjectMetadataItem({ objectNameSingular: CoreObjectNameSingular.Dashboard, }); @@ -37,12 +24,7 @@ export const useDuplicateDashboard = () => { objectMetadataItem, }); - const [mutate] = useMutation< - { duplicateDashboard: DuplicateDashboardResult }, - { id: string } - >(DUPLICATE_DASHBOARD, { - client: apolloCoreClient, - }); + const [mutate] = useDuplicateDashboardMutation(); const duplicateDashboard = async (dashboardId: string) => { const result = await mutate({