diff --git a/web/core/components/issues/issue-detail/parent-select.tsx b/web/core/components/issues/issue-detail/parent-select.tsx index 3d5f8c3063..26694f5a91 100644 --- a/web/core/components/issues/issue-detail/parent-select.tsx +++ b/web/core/components/issues/issue-detail/parent-select.tsx @@ -48,7 +48,7 @@ export const IssueParentSelect: React.FC = observer((props) const handleParentIssue = async (_issueId: string | null = null) => { try { await issueOperations.update(workspaceSlug, projectId, issueId, { parent_id: _issueId }); - await issueOperations.fetch(workspaceSlug, projectId, issueId); + await issueOperations.fetch(workspaceSlug, projectId, issueId, false); _issueId && (await fetchSubIssues(workspaceSlug, projectId, _issueId)); toggleParentIssueModal(null); } catch (error) { diff --git a/web/core/components/issues/issue-detail/root.tsx b/web/core/components/issues/issue-detail/root.tsx index f2ec225681..e520da2acb 100644 --- a/web/core/components/issues/issue-detail/root.tsx +++ b/web/core/components/issues/issue-detail/root.tsx @@ -24,7 +24,7 @@ import { IssueMainContent } from "./main-content"; import { IssueDetailsSidebar } from "./sidebar"; export type TIssueOperations = { - fetch: (workspaceSlug: string, projectId: string, issueId: string) => Promise; + fetch: (workspaceSlug: string, projectId: string, issueId: string, loader?: boolean) => Promise; update: (workspaceSlug: string, projectId: string, issueId: string, data: Partial) => Promise; remove: (workspaceSlug: string, projectId: string, issueId: string) => Promise; archive?: (workspaceSlug: string, projectId: string, issueId: string) => Promise; diff --git a/web/core/components/issues/peek-overview/root.tsx b/web/core/components/issues/peek-overview/root.tsx index 597f3179af..10241f95d9 100644 --- a/web/core/components/issues/peek-overview/root.tsx +++ b/web/core/components/issues/peek-overview/root.tsx @@ -6,7 +6,7 @@ import { usePathname } from "next/navigation"; import { TIssue } from "@plane/types"; import { TOAST_TYPE, setPromiseToast, setToast } from "@plane/ui"; // components -import { IssueView } from "@/components/issues"; +import { IssueView, TIssueOperations } from "@/components/issues"; // constants import { ISSUE_UPDATED, ISSUE_DELETED, ISSUE_ARCHIVED, ISSUE_RESTORED } from "@/constants/event-tracker"; import { EIssuesStoreType } from "@/constants/issue"; @@ -22,29 +22,6 @@ interface IIssuePeekOverview { is_draft?: boolean; } -export type TIssuePeekOperations = { - fetch: (workspaceSlug: string, projectId: string, issueId: string) => Promise; - update: (workspaceSlug: string, projectId: string, issueId: string, data: Partial) => Promise; - remove: (workspaceSlug: string, projectId: string, issueId: string) => Promise; - archive: (workspaceSlug: string, projectId: string, issueId: string) => Promise; - restore: (workspaceSlug: string, projectId: string, issueId: string) => Promise; - addIssueToCycle: (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => Promise; - removeIssueFromCycle: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise; - addModulesToIssue?: (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => Promise; - removeIssueFromModule?: ( - workspaceSlug: string, - projectId: string, - moduleId: string, - issueId: string - ) => Promise; - removeModulesFromIssue?: ( - workspaceSlug: string, - projectId: string, - issueId: string, - moduleIds: string[] - ) => Promise; -}; - export const IssuePeekOverview: FC = observer((props) => { const { embedIssue = false, embedRemoveCurrentNotification, is_archived = false, is_draft = false } = props; // router @@ -66,11 +43,11 @@ export const IssuePeekOverview: FC = observer((props) => { const [loader, setLoader] = useState(true); const [error, setError] = useState(false); - const issueOperations: TIssuePeekOperations = useMemo( + const issueOperations: TIssueOperations = useMemo( () => ({ - fetch: async (workspaceSlug: string, projectId: string, issueId: string) => { + fetch: async (workspaceSlug: string, projectId: string, issueId: string, loader = true) => { try { - setLoader(true); + setLoader(loader); setError(false); await fetchIssue( workspaceSlug, diff --git a/web/core/store/issue/issue-details/sub_issues.store.ts b/web/core/store/issue/issue-details/sub_issues.store.ts index 0bbdffe499..da25d9bfb4 100644 --- a/web/core/store/issue/issue-details/sub_issues.store.ts +++ b/web/core/store/issue/issue-details/sub_issues.store.ts @@ -128,6 +128,12 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore { this.fetchOtherProjectProperties(workspaceSlug, otherProjectIds); } + if (subIssues) { + this.rootIssueDetailStore.rootIssueStore.issues.updateIssue(parentIssueId, { + sub_issues_count: subIssues.length, + }); + } + runInAction(() => { set(this.subIssuesStateDistribution, parentIssueId, subIssuesStateDistribution); set(