diff --git a/apps/app/components/core/issues-view.tsx b/apps/app/components/core/issues-view.tsx index fbe519ec7..1c0cc203e 100644 --- a/apps/app/components/core/issues-view.tsx +++ b/apps/app/components/core/issues-view.tsx @@ -364,7 +364,7 @@ export const IssuesView: React.FC = ({ setCreateViewModal(null)} - data={createViewModal} + preLoadedData={createViewModal} /> void; status: boolean; data?: IView | null; + preLoadedData?: Partial | null; }; const defaultValues: Partial = { @@ -23,7 +23,13 @@ const defaultValues: Partial = { description: "", }; -export const ViewForm: React.FC = ({ handleFormSubmit, handleClose, status, data }) => { +export const ViewForm: React.FC = ({ + handleFormSubmit, + handleClose, + status, + data, + preLoadedData, +}) => { const { register, formState: { errors, isSubmitting }, @@ -47,9 +53,10 @@ export const ViewForm: React.FC = ({ handleFormSubmit, handleClose, statu useEffect(() => { reset({ ...defaultValues, + ...preLoadedData, ...data, }); - }, [data, reset]); + }, [data, preLoadedData, reset]); useEffect(() => { if (status && data) { diff --git a/apps/app/components/views/modal.tsx b/apps/app/components/views/modal.tsx index 565072b3b..053fbea58 100644 --- a/apps/app/components/views/modal.tsx +++ b/apps/app/components/views/modal.tsx @@ -21,9 +21,10 @@ type Props = { isOpen: boolean; handleClose: () => void; data?: IView | null; + preLoadedData?: Partial | null ; }; -export const CreateUpdateViewModal: React.FC = ({ isOpen, handleClose, data }) => { +export const CreateUpdateViewModal: React.FC = ({ isOpen, handleClose, data, preLoadedData }) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -133,6 +134,7 @@ export const CreateUpdateViewModal: React.FC = ({ isOpen, handleClose, da handleClose={handleClose} status={data ? true : false} data={data} + preLoadedData={preLoadedData} />