From 77ca3ebda8a1c618de65b763719175da4bd5d7c0 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Tue, 19 Nov 2024 16:50:31 +0530 Subject: [PATCH] [WEB-2770] fix: inbox issue detail loader on focus change --- .../(projects)/notifications/page.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/web/app/[workspaceSlug]/(projects)/notifications/page.tsx b/web/app/[workspaceSlug]/(projects)/notifications/page.tsx index 1c2036efd31..4ea0c8e4258 100644 --- a/web/app/[workspaceSlug]/(projects)/notifications/page.tsx +++ b/web/app/[workspaceSlug]/(projects)/notifications/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import useSWR from "swr"; @@ -62,6 +62,11 @@ const WorkspaceDashboardPage = observer(() => { workspace_slug && project_id && is_inbox_issue ? () => fetchUserProjectInfo(workspace_slug, project_id) : null ); + const embedRemoveCurrentNotification = useCallback( + () => setCurrentSelectedNotificationId(undefined), + [setCurrentSelectedNotificationId] + ); + // clearing up the selected notifications when unmounting the page useEffect( () => () => { @@ -95,15 +100,12 @@ const WorkspaceDashboardPage = observer(() => { projectId={project_id} inboxIssueId={issue_id} isNotificationEmbed - embedRemoveCurrentNotification={() => setCurrentSelectedNotificationId(undefined)} + embedRemoveCurrentNotification={embedRemoveCurrentNotification} /> )} ) : ( - setCurrentSelectedNotificationId(undefined)} - /> + )} )}