fix: bugs (#2761)
* fix: semicolon on estimate settings page * refactor: project settings automations store implementation * fix: active cycle stuck on infinite loading * fix: removed delete project option from sidebar * fix: discloser not opening when navigating to project * fix: clear filter not working & filter appearing even if nothing is selected * refactor: select label store implementation * refactor: select state store implementation
This commit is contained in:
parent
964e880fc4
commit
e96f059f65
7 changed files with 87 additions and 102 deletions
|
|
@ -3,16 +3,13 @@ import { useRouter } from "next/router";
|
|||
import useSWR from "swr";
|
||||
import { Combobox, Transition } from "@headlessui/react";
|
||||
import { usePopper } from "react-popper";
|
||||
// services
|
||||
import { IssueLabelService } from "services/issue";
|
||||
import { observer } from "mobx-react-lite";
|
||||
// store
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
// ui
|
||||
import { IssueLabelsList } from "components/ui";
|
||||
// icons
|
||||
import { Check, Component, Plus, Search, Tag } from "lucide-react";
|
||||
// types
|
||||
import type { IIssueLabels } from "types";
|
||||
// fetch-keys
|
||||
import { PROJECT_ISSUE_LABELS } from "constants/fetch-keys";
|
||||
|
||||
type Props = {
|
||||
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
|
|
@ -22,15 +19,19 @@ type Props = {
|
|||
label?: JSX.Element;
|
||||
};
|
||||
|
||||
const issueLabelService = new IssueLabelService();
|
||||
export const IssueLabelSelect: React.FC<Props> = observer((props) => {
|
||||
const { setIsOpen, value, onChange, projectId, label } = props;
|
||||
|
||||
export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange, projectId, label }) => {
|
||||
// states
|
||||
const [query, setQuery] = useState("");
|
||||
|
||||
const router = useRouter();
|
||||
const { workspaceSlug } = router.query;
|
||||
|
||||
const {
|
||||
project: { labels, fetchProjectLabels },
|
||||
} = useMobxStore();
|
||||
|
||||
const [referenceElement, setReferenceElement] = useState<HTMLDivElement | null>(null);
|
||||
const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
|
||||
|
||||
|
|
@ -38,11 +39,11 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
|
|||
placement: "bottom-start",
|
||||
});
|
||||
|
||||
const { data: issueLabels } = useSWR<IIssueLabels[]>(
|
||||
projectId ? PROJECT_ISSUE_LABELS(projectId) : null,
|
||||
workspaceSlug && projectId
|
||||
? () => issueLabelService.getProjectIssueLabels(workspaceSlug as string, projectId)
|
||||
: null
|
||||
const issueLabels = labels?.[projectId] || [];
|
||||
|
||||
useSWR(
|
||||
workspaceSlug && projectId ? `PROJECT_ISSUE_LABELS_${projectId.toUpperCase()}` : null,
|
||||
workspaceSlug && projectId ? () => fetchProjectLabels(workspaceSlug.toString(), projectId) : null
|
||||
);
|
||||
|
||||
const filteredOptions =
|
||||
|
|
@ -202,4 +203,4 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
|
|||
)}
|
||||
</Combobox>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue