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.

fix: draft issue fetch (#6416)

Anmol Singh Bhatia20893c60179c
diff --git a/web/core/components/issues/workspace-draft/root.tsx b/web/core/components/issues/workspace-draft/root.tsx
index 177b8af556..633fdead72 100644
--- a/web/core/components/issues/workspace-draft/root.tsx
+++ b/web/core/components/issues/workspace-draft/root.tsx
@@ -34,8 +34,9 @@ export const WorkspaceDraftIssuesRoot: FC<TWorkspaceDraftIssuesRoot> = observer(
// fetching issues
const { isLoading } = useSWR(
- workspaceSlug && issueIds.length <= 0 ? `WORKSPACE_DRAFT_ISSUES_${workspaceSlug}` : null,
- workspaceSlug && issueIds.length <= 0 ? async () => await fetchIssues(workspaceSlug, "init-loader") : null
+ workspaceSlug ? `WORKSPACE_DRAFT_ISSUES_${workspaceSlug}` : null,
+ workspaceSlug ? async () => await fetchIssues(workspaceSlug, "init-loader") : null,
+ { revalidateOnFocus: false, revalidateIfStale: false }
);
// handle nest issues
diff --git a/web/core/store/issue/workspace-draft/issue.store.ts b/web/core/store/issue/workspace-draft/issue.store.ts
index e6b0730dbd..9bae17451e 100644
--- a/web/core/store/issue/workspace-draft/issue.store.ts
+++ b/web/core/store/issue/workspace-draft/issue.store.ts
@@ -233,8 +233,12 @@ export class WorkspaceDraftIssues implements IWorkspaceDraftIssues {
if (results && results.length > 0) {
// adding issueIds
const issueIds = results.map((issue) => issue.id);
+ const existingIssueIds = this.issueMapIds[workspaceSlug] ?? [];
+ // new issueIds
+ const newIssueIds = issueIds.filter((issueId) => !existingIssueIds.includes(issueId));
this.addIssue(results);
- update(this.issueMapIds, [workspaceSlug], (existingIssueIds = []) => [...issueIds, ...existingIssueIds]);
+ // issue map update
+ update(this.issueMapIds, [workspaceSlug], (existingIssueIds = []) => [...newIssueIds, ...existingIssueIds]);
this.loader = undefined;
} else {
this.loader = "empty-state";