fix: cycles and modules sidebar mutation (#831)

This commit is contained in:
Aaryan Khandelwal 2023-04-14 19:40:00 +05:30 committed by GitHub
parent b7ce69c220
commit 8638170a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 153 additions and 117 deletions

View File

@ -19,7 +19,12 @@ import { LayerDiagonalIcon } from "components/icons";
// types // types
import { IIssue } from "types"; import { IIssue } from "types";
// fetch-keys // fetch-keys
import { CYCLE_ISSUES_WITH_PARAMS, MODULE_ISSUES_WITH_PARAMS } from "constants/fetch-keys"; import {
CYCLE_DETAILS,
CYCLE_ISSUES_WITH_PARAMS,
MODULE_DETAILS,
MODULE_ISSUES_WITH_PARAMS,
} from "constants/fetch-keys";
type FormInput = { type FormInput = {
issues: string[]; issues: string[];
@ -76,8 +81,14 @@ export const ExistingIssuesListModal: React.FC<Props> = ({
} }
await handleOnSubmit(data); await handleOnSubmit(data);
if (cycleId) mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params)); if (cycleId) {
if (moduleId) mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params));
mutate(CYCLE_DETAILS(cycleId as string));
}
if (moduleId) {
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params));
mutate(MODULE_DETAILS(moduleId as string));
}
handleClose(); handleClose();

View File

@ -234,7 +234,7 @@ export const IssuesView: React.FC<Props> = ({
) )
trackEventServices.trackIssueMarkedAsDoneEvent({ trackEventServices.trackIssueMarkedAsDoneEvent({
workspaceSlug, workspaceSlug,
workspaceId: draggedItem.workspace_detail.id, workspaceId: draggedItem.workspace,
projectName: draggedItem.project_detail.name, projectName: draggedItem.project_detail.name,
projectIdentifier: draggedItem.project_detail.identifier, projectIdentifier: draggedItem.project_detail.identifier,
projectId, projectId,

View File

@ -29,6 +29,8 @@ import {
PROJECT_ISSUES_LIST_WITH_PARAMS, PROJECT_ISSUES_LIST_WITH_PARAMS,
CYCLE_ISSUES_WITH_PARAMS, CYCLE_ISSUES_WITH_PARAMS,
MODULE_ISSUES_WITH_PARAMS, MODULE_ISSUES_WITH_PARAMS,
CYCLE_DETAILS,
MODULE_DETAILS,
} from "constants/fetch-keys"; } from "constants/fetch-keys";
export interface IssuesModalProps { export interface IssuesModalProps {
@ -101,7 +103,10 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = ({
issues: [issueId], issues: [issueId],
}) })
.then(() => { .then(() => {
if (cycleId) {
mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId, params)); mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId, params));
mutate(CYCLE_DETAILS(cycleId as string));
}
}); });
}; };
@ -113,7 +118,10 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = ({
issues: [issueId], issues: [issueId],
}) })
.then(() => { .then(() => {
if (moduleId) {
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params));
mutate(MODULE_DETAILS(moduleId as string));
}
}); });
}; };

View File

@ -75,8 +75,8 @@ export const ViewAssigneeSelect: React.FC<Props> = ({
trackEventServices.trackIssuePartialPropertyUpdateEvent( trackEventServices.trackIssuePartialPropertyUpdateEvent(
{ {
workspaceSlug: issue.workspace_detail.slug, workspaceSlug,
workspaceId: issue.workspace_detail.id, workspaceId: issue.workspace,
projectId: issue.project_detail.id, projectId: issue.project_detail.id,
projectIdentifier: issue.project_detail.identifier, projectIdentifier: issue.project_detail.identifier,
projectName: issue.project_detail.name, projectName: issue.project_detail.name,

View File

@ -1,3 +1,5 @@
import { useRouter } from "next/router";
// ui // ui
import { CustomDatePicker, Tooltip } from "components/ui"; import { CustomDatePicker, Tooltip } from "components/ui";
// helpers // helpers
@ -13,7 +15,11 @@ type Props = {
isNotAllowed: boolean; isNotAllowed: boolean;
}; };
export const ViewDueDateSelect: React.FC<Props> = ({ issue, partialUpdateIssue, isNotAllowed }) => ( export const ViewDueDateSelect: React.FC<Props> = ({ issue, partialUpdateIssue, isNotAllowed }) => {
const router = useRouter();
const { workspaceSlug } = router.query;
return (
<Tooltip tooltipHeading="Due Date" tooltipContent={issue.target_date ?? "N/A"}> <Tooltip tooltipHeading="Due Date" tooltipContent={issue.target_date ?? "N/A"}>
<div <div
className={`group relative ${ className={`group relative ${
@ -35,8 +41,8 @@ export const ViewDueDateSelect: React.FC<Props> = ({ issue, partialUpdateIssue,
}); });
trackEventServices.trackIssuePartialPropertyUpdateEvent( trackEventServices.trackIssuePartialPropertyUpdateEvent(
{ {
workspaceSlug: issue.workspace_detail.slug, workspaceSlug,
workspaceId: issue.workspace_detail.id, workspaceId: issue.workspace,
projectId: issue.project_detail.id, projectId: issue.project_detail.id,
projectIdentifier: issue.project_detail.identifier, projectIdentifier: issue.project_detail.identifier,
projectName: issue.project_detail.name, projectName: issue.project_detail.name,
@ -51,3 +57,4 @@ export const ViewDueDateSelect: React.FC<Props> = ({ issue, partialUpdateIssue,
</div> </div>
</Tooltip> </Tooltip>
); );
};

View File

@ -1,17 +1,17 @@
import React from "react"; import React from "react";
import { useRouter } from "next/router";
// services
import trackEventServices from "services/track-event.service";
// hooks
import useEstimateOption from "hooks/use-estimate-option";
// ui // ui
import { CustomSelect, Tooltip } from "components/ui"; import { CustomSelect, Tooltip } from "components/ui";
// icons // icons
import { getPriorityIcon } from "components/icons/priority-icon"; import { PlayIcon } from "@heroicons/react/24/outline";
// types // types
import { IIssue } from "types"; import { IIssue } from "types";
// constants
import { PRIORITIES } from "constants/project";
// services
import trackEventServices from "services/track-event.service";
import useEstimateOption from "hooks/use-estimate-option";
import { PlayIcon } from "@heroicons/react/24/outline";
type Props = { type Props = {
issue: IIssue; issue: IIssue;
@ -28,6 +28,9 @@ export const ViewEstimateSelect: React.FC<Props> = ({
selfPositioned = false, selfPositioned = false,
isNotAllowed, isNotAllowed,
}) => { }) => {
const router = useRouter();
const { workspaceSlug } = router.query;
const { isEstimateActive, estimatePoints } = useEstimateOption(issue.estimate_point); const { isEstimateActive, estimatePoints } = useEstimateOption(issue.estimate_point);
const estimateValue = estimatePoints?.find((e) => e.key === issue.estimate_point)?.value; const estimateValue = estimatePoints?.find((e) => e.key === issue.estimate_point)?.value;
@ -41,8 +44,8 @@ export const ViewEstimateSelect: React.FC<Props> = ({
partialUpdateIssue({ estimate_point: val }); partialUpdateIssue({ estimate_point: val });
trackEventServices.trackIssuePartialPropertyUpdateEvent( trackEventServices.trackIssuePartialPropertyUpdateEvent(
{ {
workspaceSlug: issue.workspace_detail.slug, workspaceSlug,
workspaceId: issue.workspace_detail.id, workspaceId: issue.workspace,
projectId: issue.project_detail.id, projectId: issue.project_detail.id,
projectIdentifier: issue.project_detail.identifier, projectIdentifier: issue.project_detail.identifier,
projectName: issue.project_detail.name, projectName: issue.project_detail.name,

View File

@ -1,5 +1,7 @@
import React from "react"; import React from "react";
import { useRouter } from "next/router";
// ui // ui
import { CustomSelect, Tooltip } from "components/ui"; import { CustomSelect, Tooltip } from "components/ui";
// icons // icons
@ -25,15 +27,19 @@ export const ViewPrioritySelect: React.FC<Props> = ({
position = "left", position = "left",
selfPositioned = false, selfPositioned = false,
isNotAllowed, isNotAllowed,
}) => ( }) => {
const router = useRouter();
const { workspaceSlug } = router.query;
return (
<CustomSelect <CustomSelect
value={issue.priority} value={issue.priority}
onChange={(data: string) => { onChange={(data: string) => {
partialUpdateIssue({ priority: data }); partialUpdateIssue({ priority: data });
trackEventServices.trackIssuePartialPropertyUpdateEvent( trackEventServices.trackIssuePartialPropertyUpdateEvent(
{ {
workspaceSlug: issue.workspace_detail.slug, workspaceSlug,
workspaceId: issue.workspace_detail.id, workspaceId: issue.workspace,
projectId: issue.project_detail.id, projectId: issue.project_detail.id,
projectIdentifier: issue.project_detail.identifier, projectIdentifier: issue.project_detail.identifier,
projectName: issue.project_detail.name, projectName: issue.project_detail.name,
@ -85,3 +91,4 @@ export const ViewPrioritySelect: React.FC<Props> = ({
))} ))}
</CustomSelect> </CustomSelect>
); );
};

View File

@ -67,8 +67,8 @@ export const ViewStateSelect: React.FC<Props> = ({
}); });
trackEventServices.trackIssuePartialPropertyUpdateEvent( trackEventServices.trackIssuePartialPropertyUpdateEvent(
{ {
workspaceSlug: issue.workspace_detail.slug, workspaceSlug,
workspaceId: issue.workspace_detail.id, workspaceId: issue.workspace,
projectId: issue.project_detail.id, projectId: issue.project_detail.id,
projectIdentifier: issue.project_detail.identifier, projectIdentifier: issue.project_detail.identifier,
projectName: issue.project_detail.name, projectName: issue.project_detail.name,