[WEB-1481] fix: inbox issue list update after changing issue status. (#4715)
This commit is contained in:
parent
2331404d46
commit
9a4971efa4
3 changed files with 27 additions and 39 deletions
|
|
@ -52,7 +52,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
|||
const [declineIssueModal, setDeclineIssueModal] = useState(false);
|
||||
const [deleteIssueModal, setDeleteIssueModal] = useState(false);
|
||||
// store
|
||||
const { currentTab, deleteInboxIssue, inboxIssueIds } = useProjectInbox();
|
||||
const { currentTab, deleteInboxIssue, filteredInboxIssueIds } = useProjectInbox();
|
||||
const { data: currentUser } = useUser();
|
||||
const {
|
||||
membership: { currentProjectRole },
|
||||
|
|
@ -76,11 +76,11 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
|||
|
||||
const redirectIssue = (): string | undefined => {
|
||||
let nextOrPreviousIssueId: string | undefined = undefined;
|
||||
const currentIssueIndex = inboxIssueIds.findIndex((id) => id === currentInboxIssueId);
|
||||
if (inboxIssueIds[currentIssueIndex + 1])
|
||||
nextOrPreviousIssueId = inboxIssueIds[currentIssueIndex + 1];
|
||||
else if (inboxIssueIds[currentIssueIndex - 1])
|
||||
nextOrPreviousIssueId = inboxIssueIds[currentIssueIndex - 1];
|
||||
const currentIssueIndex = filteredInboxIssueIds.findIndex((id) => id === currentInboxIssueId);
|
||||
if (filteredInboxIssueIds[currentIssueIndex + 1])
|
||||
nextOrPreviousIssueId = filteredInboxIssueIds[currentIssueIndex + 1];
|
||||
else if (filteredInboxIssueIds[currentIssueIndex - 1])
|
||||
nextOrPreviousIssueId = filteredInboxIssueIds[currentIssueIndex - 1];
|
||||
else nextOrPreviousIssueId = undefined;
|
||||
return nextOrPreviousIssueId;
|
||||
};
|
||||
|
|
@ -134,22 +134,22 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
|||
})
|
||||
);
|
||||
|
||||
const currentIssueIndex = inboxIssueIds.findIndex((issueId) => issueId === currentInboxIssueId) ?? 0;
|
||||
const currentIssueIndex = filteredInboxIssueIds.findIndex((issueId) => issueId === currentInboxIssueId) ?? 0;
|
||||
|
||||
const handleInboxIssueNavigation = useCallback(
|
||||
(direction: "next" | "prev") => {
|
||||
if (!inboxIssueIds || !currentInboxIssueId) return;
|
||||
if (!filteredInboxIssueIds || !currentInboxIssueId) return;
|
||||
const activeElement = document.activeElement as HTMLElement;
|
||||
if (activeElement && (activeElement.classList.contains("tiptap") || activeElement.id === "title-input")) return;
|
||||
const nextIssueIndex =
|
||||
direction === "next"
|
||||
? (currentIssueIndex + 1) % inboxIssueIds.length
|
||||
: (currentIssueIndex - 1 + inboxIssueIds.length) % inboxIssueIds.length;
|
||||
const nextIssueId = inboxIssueIds[nextIssueIndex];
|
||||
? (currentIssueIndex + 1) % filteredInboxIssueIds.length
|
||||
: (currentIssueIndex - 1 + filteredInboxIssueIds.length) % filteredInboxIssueIds.length;
|
||||
const nextIssueId = filteredInboxIssueIds[nextIssueIndex];
|
||||
if (!nextIssueId) return;
|
||||
router.push(`/${workspaceSlug}/projects/${projectId}/inbox?inboxIssueId=${nextIssueId}`);
|
||||
},
|
||||
[currentInboxIssueId, currentIssueIndex, inboxIssueIds, projectId, router, workspaceSlug]
|
||||
[currentInboxIssueId, currentIssueIndex, filteredInboxIssueIds, projectId, router, workspaceSlug]
|
||||
);
|
||||
|
||||
const onKeyDown = useCallback(
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export const InboxSidebar: FC<IInboxSidebarProps> = observer((props) => {
|
|||
currentTab,
|
||||
handleCurrentTab,
|
||||
loader,
|
||||
inboxIssueIds,
|
||||
filteredInboxIssueIds,
|
||||
inboxIssuePaginationInfo,
|
||||
fetchInboxPaginationIssues,
|
||||
getAppliedFiltersCount,
|
||||
|
|
@ -106,13 +106,13 @@ export const InboxSidebar: FC<IInboxSidebarProps> = observer((props) => {
|
|||
className="w-full h-full overflow-hidden overflow-y-auto vertical-scrollbar scrollbar-md"
|
||||
ref={containerRef}
|
||||
>
|
||||
{inboxIssueIds.length > 0 ? (
|
||||
{filteredInboxIssueIds.length > 0 ? (
|
||||
<InboxIssueList
|
||||
setIsMobileSidebar={setIsMobileSidebar}
|
||||
workspaceSlug={workspaceSlug}
|
||||
projectId={projectId}
|
||||
projectIdentifier={currentProjectDetails?.identifier}
|
||||
inboxIssueIds={inboxIssueIds}
|
||||
inboxIssueIds={filteredInboxIssueIds}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex items-center justify-center h-full w-full">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue