diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx index bcdb9b90ac..dd9676dede 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx @@ -3,6 +3,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode'; import { useRecoilValue } from 'recoil'; +import { useResetLocationHash } from 'twenty-ui/utilities'; export const EditDashboardSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); @@ -14,8 +15,11 @@ export const EditDashboardSingleRecordAction = () => { const { setIsPageLayoutInEditMode } = useSetIsPageLayoutInEditMode(pageLayoutId); + const { resetLocationHash } = useResetLocationHash(); + const handleClick = () => { setIsPageLayoutInEditMode(true); + resetLocationHash(); }; return ; diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRendererContent.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRendererContent.tsx index 5e56df43c3..40d3f7d79d 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRendererContent.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRendererContent.tsx @@ -18,12 +18,12 @@ import { getTabsWithVisibleWidgets } from '@/page-layout/utils/getTabsWithVisibl import { sortTabsByPosition } from '@/page-layout/utils/sortTabsByPosition'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue'; import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; +import { useIsMobile } from 'twenty-ui/utilities'; const StyledContainer = styled.div<{ hasPinnedTab: boolean }>` display: grid; @@ -120,7 +120,7 @@ export const PageLayoutRendererContent = () => { {(sortedTabs.length > 1 || isPageLayoutInEditMode) && ( & { isReorderEnabled: boolean; onAddTab?: () => void; onReorder?: (result: DropResult, provided: ResponderProvided) => boolean; + behaveAsLinks: boolean; }; export const PageLayoutTabList = ({ tabs, loading, - behaveAsLinks = true, + behaveAsLinks, isInRightDrawer, className, componentInstanceId, diff --git a/packages/twenty-ui/src/utilities/index.ts b/packages/twenty-ui/src/utilities/index.ts index 9513838988..832ad50195 100644 --- a/packages/twenty-ui/src/utilities/index.ts +++ b/packages/twenty-ui/src/utilities/index.ts @@ -26,6 +26,7 @@ export { getOsShortcutSeparator } from './device/getOsShortcutSeparator'; export { getUserDevice } from './device/getUserDevice'; export { AutogrowWrapper } from './dimensions/components/AutogrowWrapper'; export { useMouseDownNavigation } from './navigation/hooks/useMouseDownNavigation'; +export { useResetLocationHash } from './navigation/hooks/useResetLocationHash'; export { isNavigationModifierPressed } from './navigation/isNavigationModifierPressed'; export type { TriggerEventType } from './navigation/types/trigger-event.type'; export { useIsMobile } from './responsive/hooks/useIsMobile'; diff --git a/packages/twenty-ui/src/utilities/navigation/hooks/useResetLocationHash.ts b/packages/twenty-ui/src/utilities/navigation/hooks/useResetLocationHash.ts new file mode 100644 index 0000000000..c6173c1eff --- /dev/null +++ b/packages/twenty-ui/src/utilities/navigation/hooks/useResetLocationHash.ts @@ -0,0 +1,13 @@ +import { useLocation, useNavigate } from 'react-router-dom'; + +export const useResetLocationHash = () => { + const navigate = useNavigate(); + const location = useLocation(); + + // eslint-disable-next-line @nx/workspace-no-navigate-prefer-link + const resetLocationHash = () => { + navigate(location.pathname, { replace: true }); + }; + + return { resetLocationHash }; +};