forked from github/plane
fix: selecting label once create using modal (#1537)
This commit is contained in:
parent
16a7bd3bda
commit
9d891ecce1
@ -254,6 +254,10 @@ export const IssueForm: FC<IssueFormProps> = ({
|
|||||||
handleClose={() => setLabelModal(false)}
|
handleClose={() => setLabelModal(false)}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
user={user}
|
user={user}
|
||||||
|
onSuccess={(response) => {
|
||||||
|
setValue("labels", [...watch("labels"), response.id]);
|
||||||
|
setValue("labels_list", [...watch("labels_list"), response.id]);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@ -26,6 +26,7 @@ type Props = {
|
|||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
handleClose: () => void;
|
handleClose: () => void;
|
||||||
|
onSuccess?: (response: IIssueLabels) => void;
|
||||||
user: ICurrentUserResponse | undefined;
|
user: ICurrentUserResponse | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -34,7 +35,13 @@ const defaultValues: Partial<IState> = {
|
|||||||
color: "rgb(var(--color-text-200))",
|
color: "rgb(var(--color-text-200))",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CreateLabelModal: React.FC<Props> = ({ isOpen, projectId, handleClose, user }) => {
|
export const CreateLabelModal: React.FC<Props> = ({
|
||||||
|
isOpen,
|
||||||
|
projectId,
|
||||||
|
handleClose,
|
||||||
|
user,
|
||||||
|
onSuccess,
|
||||||
|
}) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
|
|
||||||
@ -66,6 +73,7 @@ export const CreateLabelModal: React.FC<Props> = ({ isOpen, projectId, handleClo
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
onClose();
|
onClose();
|
||||||
|
if (onSuccess) onSuccess(res);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -553,6 +553,11 @@ const SinglePage: NextPage = () => {
|
|||||||
handleClose={() => setLabelModal(false)}
|
handleClose={() => setLabelModal(false)}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
user={user}
|
user={user}
|
||||||
|
onSuccess={(response) => {
|
||||||
|
partialUpdatePage({
|
||||||
|
labels_list: [...(pageDetails.labels ?? []), response.id],
|
||||||
|
});
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user