From 72722d9cebbc2a0ad616f6e62cdcd87c278da0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Wed, 7 Aug 2024 16:27:54 +0200 Subject: [PATCH] Remove navigateBack --- .../hooks/useGetAvailableFieldsForKanban.ts | 4 +--- .../SettingsObjectNewFieldStep2.tsx | 10 ++-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts index cbb6cfca07dc..1c595472bf6b 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts @@ -37,9 +37,7 @@ export const useGetAvailableFieldsForKanban = () => { navigate( `/settings/objects/${getObjectSlug( objectMetadataItem, - )}/new-field/step-2?fieldType=${ - FieldMetadataType.Select - }&navigateBack=true`, + )}/new-field/step-2?fieldType=${FieldMetadataType.Select}`, ); } else { navigate(`/settings/objects`); diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldStep2.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldStep2.tsx index 1cb93a03f050..28fa8d6dc195 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldStep2.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldStep2.tsx @@ -50,7 +50,6 @@ export const SettingsObjectNewFieldStep2 = () => { const { objectSlug = '' } = useParams(); const [searchParams] = useSearchParams(); const fieldType = searchParams.get('fieldType'); - const navigateBack = searchParams.get('navigateBack'); const { enqueueSnackBar } = useSnackBar(); const { findActiveObjectMetadataItemBySlug } = @@ -148,11 +147,7 @@ export const SettingsObjectNewFieldStep2 = () => { }); } - if (navigateBack?.toLowerCase() === 'true') { - navigate(-1); - } else { - navigate(`/settings/objects/${objectSlug}`); - } + navigate(`/settings/objects/${objectSlug}`); // TODO: fix optimistic update logic // Forcing a refetch for now but it's not ideal @@ -198,8 +193,7 @@ export const SettingsObjectNewFieldStep2 = () => { isSaveDisabled={!canSave} isCancelDisabled={isSubmitting} onCancel={() => { - if (navigateBack?.toLowerCase() === 'true') navigate(-1); - else navigate(`/settings/objects/${objectSlug}`); + navigate(`/settings/objects/${objectSlug}`); }} onSave={formConfig.handleSubmit(handleSave)} />