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)} - /> + )} )}