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 the logic (#5807)

Ketan Sharma9530884c5925
diff --git a/web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx b/web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx
index a7a0a5c0ac..5a1becee22 100644
--- a/web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx
+++ b/web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx
@@ -8,7 +8,7 @@ import { PlusIcon } from "lucide-react";
// types
import { ISearchIssueResponse, TIssue } from "@plane/types";
// ui
-import { TOAST_TYPE, setToast, CustomMenu } from "@plane/ui";
+import { CustomMenu, setPromiseToast } from "@plane/ui";
// components
import { ExistingIssuesListModal } from "@/components/core";
import { QuickAddIssueRoot } from "@/components/issues";
@@ -45,22 +45,21 @@ export const CalendarQuickAddIssueActions: FC<TCalendarQuickAddIssueActions> = o
if (!workspaceSlug || !projectId) return;
const issueIds = data.map((i) => i.id);
+ const addExistingIssuesPromise = Promise.all(
+ data.map((issue) => updateIssue(workspaceSlug.toString(), projectId.toString(), issue.id, prePopulatedData ?? {}))
+ ).then(() => addIssuesToView?.(issueIds));
- try {
- // To handle all updates in parallel
- await Promise.all(
- data.map((issue) =>
- updateIssue(workspaceSlug.toString(), projectId.toString(), issue.id, prePopulatedData ?? {})
- )
- );
- await addIssuesToView?.(issueIds);
- } catch (error) {
- setToast({
- type: TOAST_TYPE.ERROR,
+ setPromiseToast(addExistingIssuesPromise, {
+ loading: `Adding ${issueIds.length > 1 ? "issues" : "issue"} to cycle...`,
+ success: {
+ title: "Success!",
+ message: () => `${issueIds.length > 1 ? "Issues" : "Issue"} added to cycle successfully.`,
+ },
+ error: {
title: "Error!",
- message: "Something went wrong. Please try again.",
- });
- }
+ message: (err) => err?.message || "Something went wrong. Please try again.",
+ },
+ });
};
const handleNewIssue = () => {
@@ -130,4 +129,4 @@ export const CalendarQuickAddIssueActions: FC<TCalendarQuickAddIssueActions> = o
/>
</>
);
-});
+});
\ No newline at end of file