[WEB-2770] fix: inbox issue detail loader on focus change (#6074)

This commit is contained in:
Prateek Shourya 2024-11-19 17:07:32 +05:30 committed by GitHub
parent a3e8ee6045
commit 6f497b024b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,6 @@
"use client"; "use client";
import { useEffect } from "react"; import { useCallback, useEffect } from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { useParams } from "next/navigation"; import { useParams } from "next/navigation";
import useSWR from "swr"; import useSWR from "swr";
@ -62,6 +62,11 @@ const WorkspaceDashboardPage = observer(() => {
workspace_slug && project_id && is_inbox_issue ? () => fetchUserProjectInfo(workspace_slug, project_id) : null 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 // clearing up the selected notifications when unmounting the page
useEffect( useEffect(
() => () => { () => () => {
@ -95,15 +100,12 @@ const WorkspaceDashboardPage = observer(() => {
projectId={project_id} projectId={project_id}
inboxIssueId={issue_id} inboxIssueId={issue_id}
isNotificationEmbed isNotificationEmbed
embedRemoveCurrentNotification={() => setCurrentSelectedNotificationId(undefined)} embedRemoveCurrentNotification={embedRemoveCurrentNotification}
/> />
)} )}
</> </>
) : ( ) : (
<IssuePeekOverview <IssuePeekOverview embedIssue embedRemoveCurrentNotification={embedRemoveCurrentNotification} />
embedIssue
embedRemoveCurrentNotification={() => setCurrentSelectedNotificationId(undefined)}
/>
)} )}
</> </>
)} )}