fix: issues mutation on changing filters (#2485)
* chore: refetch issues on filters and display filters change * fix: issues list mutation after creating an issue * fix: module issues fetch * fix: build error
This commit is contained in:
parent
85a471305a
commit
0b8367a262
16 changed files with 173 additions and 181 deletions
|
|
@ -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";
|
||||
|
|
@ -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";
|
||||
|
||||
|
|
@ -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"
|
||||
|
|
@ -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,
|
||||
|
|
@ -87,7 +89,6 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
|
|||
setCreateMore,
|
||||
handleDiscardClose,
|
||||
status,
|
||||
user,
|
||||
fieldsToShow,
|
||||
handleFormDirty,
|
||||
} = props;
|
||||
|
|
@ -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 {
|
||||
|
|
@ -174,7 +179,7 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
|
|||
};
|
||||
|
||||
const handleAutoGenerateDescription = async () => {
|
||||
if (!workspaceSlug || !projectId) return;
|
||||
if (!workspaceSlug || !projectId || !user) return;
|
||||
|
||||
setIAmFeelingLucky(true);
|
||||
|
||||
|
|
@ -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]);
|
||||
|
|
@ -605,4 +610,4 @@ export const IssueForm: FC<IssueFormProps> = (props) => {
|
|||
</form>
|
||||
</>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue