Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issues mutation on changing filters #2485

Merged
merged 6 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/components/core/views/inline-issue-create-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const InlineCreateIssueFormWrapper: React.FC<Props> = (props) => {
reset({ ...defaultValues });

await (!isDraftIssues
? issueService.createIssues(workspaceSlug.toString(), projectId.toString(), formData, user)
? issueService.createIssue(workspaceSlug.toString(), projectId.toString(), formData, user)
: issueDraftService.createDraftIssue(workspaceSlug.toString(), projectId.toString(), formData)
)
.then(async (res) => {
Expand Down
8 changes: 3 additions & 5 deletions web/components/gantt-chart/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { useRouter } from "next/router";
// react-beautiful-dnd
import { DragDropContext, Draggable, DropResult } from "react-beautiful-dnd";
import StrictModeDroppable from "components/dnd/StrictModeDroppable";
import { MoreVertical } from "lucide-react";
// hooks
import { useChart } from "./hooks";
// ui
import { Loader } from "@plane/ui";
// icons
import { MoreVertical } from "lucide-react";
// helpers
import { findTotalDaysInRange } from "helpers/date-time.helper";
// types
Expand Down Expand Up @@ -124,8 +122,8 @@ export const GanttSidebar: React.FC<Props> = (props) => {
className="rounded p-0.5 text-custom-sidebar-text-200 flex flex-shrink-0 opacity-0 group-hover:opacity-100"
{...provided.dragHandleProps}
>
<MoreVertical className="h-4" />
<MoreVertical className="h-4 -ml-5" />
<MoreVertical className="h-3.5 w-3.5" />
<MoreVertical className="h-3.5 w-3.5 -ml-5" />
</button>
)}
<div className="flex-grow truncate h-full flex items-center justify-between gap-2">
Expand Down
21 changes: 13 additions & 8 deletions web/components/issues/form.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React, { FC, useState, useEffect, useRef } from "react";
import { useRouter } from "next/router";
import { observer } from "mobx-react-lite";
import { Controller, useForm } from "react-hook-form";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
// services
import { AIService } from "services/ai.service";
import { FileService } from "services/file.service";
Expand All @@ -26,7 +29,7 @@ import { Button, Input, ToggleSwitch } from "@plane/ui";
// icons
import { LayoutPanelTop, Sparkle, X } from "lucide-react";
// types
import type { IUser, IIssue, ISearchIssueResponse } from "types";
import type { IIssue, ISearchIssueResponse } from "types";
// components
import { RichTextEditorWithRef } from "@plane/rich-text-editor";

Expand Down Expand Up @@ -55,7 +58,6 @@ export interface IssueFormProps {
setCreateMore: React.Dispatch<React.SetStateAction<boolean>>;
handleDiscardClose: () => void;
status: boolean;
user: IUser | undefined;
handleFormDirty: (payload: Partial<IIssue> | null) => void;
fieldsToShow: (
| "project"
Expand All @@ -77,7 +79,7 @@ export interface IssueFormProps {
const aiService = new AIService();
const fileService = new FileService();

export const IssueForm: FC<IssueFormProps> = (props) => {
export const IssueForm: FC<IssueFormProps> = observer((props) => {
const {
handleFormSubmit,
initialData,
Expand All @@ -87,7 +89,6 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
setCreateMore,
handleDiscardClose,
status,
user,
fieldsToShow,
handleFormDirty,
} = props;
Expand All @@ -105,6 +106,10 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
const router = useRouter();
const { workspaceSlug } = router.query;

const { user: userStore } = useMobxStore();

const user = userStore.currentUser;

const { setToastAlert } = useToast();

const {
Expand Down Expand Up @@ -174,7 +179,7 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
};

const handleAutoGenerateDescription = async () => {
if (!workspaceSlug || !projectId) return;
if (!workspaceSlug || !projectId || !user) return;

setIAmFeelingLucky(true);

Expand Down Expand Up @@ -251,13 +256,13 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
isOpen={stateModal}
handleClose={() => setStateModal(false)}
projectId={projectId}
user={user}
user={user ?? undefined}
/>
<CreateLabelModal
isOpen={labelModal}
handleClose={() => setLabelModal(false)}
projectId={projectId}
user={user}
user={user ?? undefined}
onSuccess={(response) => {
setValue("labels", [...watch("labels"), response.id]);
setValue("labels_list", [...watch("labels_list"), response.id]);
Expand Down Expand Up @@ -605,4 +610,4 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
</form>
</>
);
};
});
64 changes: 31 additions & 33 deletions web/components/issues/issue-layouts/kanban/headers/priority.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// mobx
import { observer } from "mobx-react-lite";
// lucide icons
import { AlertCircle, SignalHigh, SignalMedium, SignalLow, Ban } from "lucide-react";
// components
import { HeaderGroupByCard } from "./group-by-card";
Expand Down Expand Up @@ -44,35 +42,35 @@ const Icon = ({ priority }: any) => (
</div>
);

export const PriorityHeader: React.FC<IPriorityHeader> = observer(
({ column_id, sub_group_by, group_by, header_type, issues_count, kanBanToggle, handleKanBanToggle }) => {
const priority = column_id && issuePriorityByKey(column_id);
export const PriorityHeader: React.FC<IPriorityHeader> = observer((props) => {
const { column_id, sub_group_by, group_by, header_type, issues_count, kanBanToggle, handleKanBanToggle } = props;

return (
<>
{priority &&
(sub_group_by && header_type === "sub_group_by" ? (
<HeaderSubGroupByCard
column_id={column_id}
icon={<Icon priority={priority?.key} />}
title={priority?.key || ""}
count={issues_count}
kanBanToggle={kanBanToggle}
handleKanBanToggle={handleKanBanToggle}
/>
) : (
<HeaderGroupByCard
sub_group_by={sub_group_by}
group_by={group_by}
column_id={column_id}
icon={<Icon priority={priority?.key} />}
title={priority?.key || ""}
count={issues_count}
kanBanToggle={kanBanToggle}
handleKanBanToggle={handleKanBanToggle}
/>
))}
</>
);
}
);
const priority = column_id && issuePriorityByKey(column_id);

return (
<>
{priority &&
(sub_group_by && header_type === "sub_group_by" ? (
<HeaderSubGroupByCard
column_id={column_id}
icon={<Icon priority={priority?.key} />}
title={priority?.title || ""}
count={issues_count}
kanBanToggle={kanBanToggle}
handleKanBanToggle={handleKanBanToggle}
/>
) : (
<HeaderGroupByCard
sub_group_by={sub_group_by}
group_by={group_by}
column_id={column_id}
icon={<Icon priority={priority?.key} />}
title={priority?.title || ""}
count={issues_count}
kanBanToggle={kanBanToggle}
handleKanBanToggle={handleKanBanToggle}
/>
))}
</>
);
});
7 changes: 5 additions & 2 deletions web/components/issues/issue-layouts/list/headers/priority.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { FC } from "react";
import { observer } from "mobx-react-lite";
// lucide icons
import { AlertCircle, SignalHigh, SignalMedium, SignalLow, Ban } from "lucide-react";
// components
import { HeaderGroupByCard } from "./group-by-card";
Expand Down Expand Up @@ -45,7 +44,11 @@ export const PriorityHeader: FC<IPriorityHeader> = observer((props) => {
return (
<>
{priority && (
<HeaderGroupByCard icon={<Icon priority={priority?.key} />} title={priority?.key || ""} count={issues_count} />
<HeaderGroupByCard
icon={<Icon priority={priority?.key} />}
title={priority?.title || ""}
count={issues_count}
/>
)}
</>
);
Expand Down
Loading
Loading