fix dashboard duplicate (#18193)
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>
This commit is contained in:
-1
@@ -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,
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user