From 0a3d13706e9b4e9c15323d9cab3dd9379ddb3395 Mon Sep 17 00:00:00 2001 From: Kunal Vishwakarma <116634168+kunalv17@users.noreply.github.com> Date: Sat, 8 Apr 2023 01:24:24 +0530 Subject: [PATCH] fix: mutation issue in cycles (#739) * fix: mutation issue in cycles * fix: removed comments --- apps/app/components/cycles/modal.tsx | 3 ++ .../cycles/transfer-issues-modal.tsx | 30 ++++++++++++++----- .../app/components/cycles/transfer-issues.tsx | 2 +- apps/app/components/icons/transfer-icon.tsx | 4 +-- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/apps/app/components/cycles/modal.tsx b/apps/app/components/cycles/modal.tsx index 19311cd08..e90811ab8 100644 --- a/apps/app/components/cycles/modal.tsx +++ b/apps/app/components/cycles/modal.tsx @@ -21,7 +21,9 @@ import { CYCLE_COMPLETE_LIST, CYCLE_CURRENT_AND_UPCOMING_LIST, CYCLE_DRAFT_LIST, + CYCLE_INCOMPLETE_LIST, } from "constants/fetch-keys"; +import { IncomingMessage } from "http"; type CycleModalProps = { isOpen: boolean; @@ -56,6 +58,7 @@ export const CreateUpdateCycleModal: React.FC = ({ default: mutate(CYCLE_DRAFT_LIST(projectId as string)); } + mutate(CYCLE_INCOMPLETE_LIST(projectId as string)); handleClose(); setToastAlert({ diff --git a/apps/app/components/cycles/transfer-issues-modal.tsx b/apps/app/components/cycles/transfer-issues-modal.tsx index 30441666b..ef44993b9 100644 --- a/apps/app/components/cycles/transfer-issues-modal.tsx +++ b/apps/app/components/cycles/transfer-issues-modal.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react"; import { useRouter } from "next/router"; -import useSWR from "swr"; +import useSWR, { mutate } from "swr"; // component import { Dialog, Transition } from "@headlessui/react"; @@ -12,11 +12,14 @@ import cyclesService from "services/cycles.service"; import useToast from "hooks/use-toast"; //icons import { MagnifyingGlassIcon, XMarkIcon } from "@heroicons/react/24/outline"; -import { ContrastIcon, CyclesIcon, ExclamationIcon } from "components/icons"; +import { ContrastIcon, CyclesIcon, ExclamationIcon, TransferIcon } from "components/icons"; // fetch-key -import { CYCLE_INCOMPLETE_LIST } from "constants/fetch-keys"; +import { CYCLE_INCOMPLETE_LIST, CYCLE_ISSUES_WITH_PARAMS } from "constants/fetch-keys"; // types import { ICycle } from "types"; +//helper +import { getDateRangeStatus } from "helpers/date-time.helper"; +import useIssuesView from "hooks/use-issues-view"; type Props = { isOpen: boolean; @@ -29,12 +32,15 @@ export const TransferIssuesModal: React.FC = ({ isOpen, handleClose }) => const router = useRouter(); const { workspaceSlug, projectId, cycleId } = router.query; + const { params } = useIssuesView(); + const { setToastAlert } = useToast(); const transferIssue = async (payload: any) => { await cyclesService .transferIssues(workspaceSlug as string, projectId as string, cycleId as string, payload) .then((res) => { + mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params)); setToastAlert({ type: "success", title: "Issues transfered successfully", @@ -100,12 +106,15 @@ export const TransferIssuesModal: React.FC = ({ isOpen, handleClose }) =>
-

Transfer Issues

+
+ +

Transfer Issues

+
-
+
= ({ isOpen, handleClose }) => filteredOptions.map((option: ICycle) => ( )) ) : ( diff --git a/apps/app/components/cycles/transfer-issues.tsx b/apps/app/components/cycles/transfer-issues.tsx index ee5ec606c..979e87b93 100644 --- a/apps/app/components/cycles/transfer-issues.tsx +++ b/apps/app/components/cycles/transfer-issues.tsx @@ -46,7 +46,7 @@ export const TransferIssues: React.FC = ({ handleClick }) => { {transferableIssuesCount > 0 && (
- + Transfer Issues
diff --git a/apps/app/components/icons/transfer-icon.tsx b/apps/app/components/icons/transfer-icon.tsx index e6b2e0840..176c38b29 100644 --- a/apps/app/components/icons/transfer-icon.tsx +++ b/apps/app/components/icons/transfer-icon.tsx @@ -2,7 +2,7 @@ import React from "react"; import type { Props } from "./types"; -export const TransferIcon: React.FC = ({ width, height, className }) => ( +export const TransferIcon: React.FC = ({ width, height, className, color }) => ( = ({ width, height, className }) => ( fill="none" xmlns="http://www.w3.org/2000/svg" > - + );