Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-1812] fix : Avoid loader when parent is added in issue detail / peek overview (#5257)

rahulrameshae3143ff00b6f
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<TIssueParentSelect> = 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<void>;
+ fetch: (workspaceSlug: string, projectId: string, issueId: string, loader?: boolean) => Promise<void>;
update: (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>;
remove: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
archive?: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
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<void>;
- update: (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>;
- remove: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
- archive: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
- restore: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
- addIssueToCycle: (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => Promise<void>;
- removeIssueFromCycle: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise<void>;
- addModulesToIssue?: (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => Promise<void>;
- removeIssueFromModule?: (
- workspaceSlug: string,
- projectId: string,
- moduleId: string,
- issueId: string
- ) => Promise<void>;
- removeModulesFromIssue?: (
- workspaceSlug: string,
- projectId: string,
- issueId: string,
- moduleIds: string[]
- ) => Promise<void>;
-};
-
export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
const { embedIssue = false, embedRemoveCurrentNotification, is_archived = false, is_draft = false } = props;
// router
@@ -66,11 +43,11 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = 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(