From ac74cd9e925663a018b9c8f713af1fe877699339 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:37:47 +0530 Subject: [PATCH] [WEB-3352] fix: home recent item redirection (#6586) * fix: dashboard recent item redirection * chore: code refactor --- web/core/components/home/widgets/recents/issue.tsx | 6 +++++- web/core/components/home/widgets/recents/page.tsx | 5 ++++- web/core/components/home/widgets/recents/project.tsx | 8 ++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/web/core/components/home/widgets/recents/issue.tsx b/web/core/components/home/widgets/recents/issue.tsx index af0894281..0c3f9ac6a 100644 --- a/web/core/components/home/widgets/recents/issue.tsx +++ b/web/core/components/home/widgets/recents/issue.tsx @@ -24,12 +24,16 @@ export const RecentIssue = (props: BlockProps) => { const { setPeekIssue } = useIssueDetail(); // derived values const issueDetails: TIssueEntityData = activity.entity_data as TIssueEntityData; + + if (!issueDetails) return <>; + const state = getStateById(issueDetails?.state); + const workItemLink = `/${workspaceSlug}/projects/${issueDetails?.project_id}/issues/${issueDetails.id}`; return ( diff --git a/web/core/components/home/widgets/recents/page.tsx b/web/core/components/home/widgets/recents/page.tsx index 95f78737a..532831d32 100644 --- a/web/core/components/home/widgets/recents/page.tsx +++ b/web/core/components/home/widgets/recents/page.tsx @@ -28,6 +28,9 @@ export const RecentPage = (props: BlockProps) => { const { getUserDetails } = useMember(); // derived values const pageDetails = activity.entity_data as TPageEntityData; + + if (!pageDetails) return <>; + const ownerDetails = getUserDetails(pageDetails?.owned_by); const pageLink = pageDetails.project_id ? `/${workspaceSlug}/projects/${pageDetails.project_id}/pages/${pageDetails.id}` @@ -36,7 +39,7 @@ export const RecentPage = (props: BlockProps) => { return ( diff --git a/web/core/components/home/widgets/recents/project.tsx b/web/core/components/home/widgets/recents/project.tsx index 1663b6bf4..9321a017f 100644 --- a/web/core/components/home/widgets/recents/project.tsx +++ b/web/core/components/home/widgets/recents/project.tsx @@ -21,10 +21,14 @@ export const RecentProject = (props: BlockProps) => { // derived values const projectDetails: TProjectEntityData = activity.entity_data as TProjectEntityData; + if (!projectDetails) return <>; + + const projectLink = `/${workspaceSlug}/projects/${projectDetails?.id}/issues`; + return ( @@ -69,7 +73,7 @@ export const RecentProject = (props: BlockProps) => { onItemClick={(e) => { e.preventDefault(); e.stopPropagation(); - router.push(`/${workspaceSlug}/projects/${projectDetails?.id}/issues`); + router.push(projectLink); }} /> );