diff --git a/web/components/issues/issue-modal/form.tsx b/web/components/issues/issue-modal/form.tsx index 1efcc9fb4c..303cb6ccfc 100644 --- a/web/components/issues/issue-modal/form.tsx +++ b/web/components/issues/issue-modal/form.tsx @@ -186,7 +186,7 @@ export const IssueFormRoot: FC = observer((props) => { }, [projectId]); useEffect(() => { - if (data?.description_html) setValue("description_html", data?.description_html); + if (data?.description_html) setValue<"description_html">("description_html", data?.description_html); }, [data?.description_html]); const issueName = watch("name"); @@ -206,7 +206,7 @@ export const IssueFormRoot: FC = observer((props) => { ? formData : { ...getChangedIssuefields(formData, dirtyFields as { [key: string]: boolean | undefined }), - project_id: getValues("project_id"), + project_id: getValues<"project_id">("project_id"), id: data.id, description_html: formData.description_html ?? "

", }; @@ -221,7 +221,7 @@ export const IssueFormRoot: FC = observer((props) => { reset({ ...defaultValues, ...(isCreateMoreToggleEnabled ? { ...data } : {}), - project_id: getValues("project_id"), + project_id: getValues<"project_id">("project_id"), description_html: data?.description_html ?? "

", }); editorRef?.current?.clearEditor(); @@ -320,7 +320,7 @@ export const IssueFormRoot: FC = observer((props) => { handleClose={() => setLabelModal(false)} projectId={projectId} onSuccess={(response) => { - setValue("label_ids", [...watch("label_ids"), response.id]); + setValue<"label_ids">("label_ids", [...watch("label_ids"), response.id]); handleFormChange(); }} /> @@ -528,7 +528,7 @@ export const IssueFormRoot: FC = observer((props) => { onChange(stateId); handleFormChange(); }} - projectId={projectId?? undefined} + projectId={projectId ?? undefined} buttonVariant="border-with-text" tabIndex={getTabIndex("state_id")} /> @@ -651,7 +651,7 @@ export const IssueFormRoot: FC = observer((props) => { render={({ field: { value, onChange } }) => (
{ onChange(moduleIds); @@ -748,7 +748,7 @@ export const IssueFormRoot: FC = observer((props) => { handleFormChange(); setSelectedParentIssue(issue); }} - projectId={projectId?? undefined} + projectId={projectId ?? undefined} issueId={isDraft ? undefined : data?.id} /> )} diff --git a/web/components/pages/editor/embed/issue-embed.tsx b/web/components/pages/editor/embed/issue-embed.tsx index b8f252b73e..ecf7ac6919 100644 --- a/web/components/pages/editor/embed/issue-embed.tsx +++ b/web/components/pages/editor/embed/issue-embed.tsx @@ -102,7 +102,13 @@ export const IssueEmbedCard: React.FC = observer((props) => { issue={issueDetails} displayProperties={displayProperties} activeLayout="Page issue embed" - updateIssue={async (projectId, issueId, data) => await updateIssue(workspaceSlug, projectId, issueId, data)} + updateIssue={async (projectId, issueId, data) => { + if (projectId) { + return await updateIssue(workspaceSlug, projectId, issueId, data); + } + + return; + }} isReadOnly={isReadOnly} /> )} diff --git a/web/helpers/issue.helper.ts b/web/helpers/issue.helper.ts index ae12ec84f8..d4847f4db5 100644 --- a/web/helpers/issue.helper.ts +++ b/web/helpers/issue.helper.ts @@ -178,7 +178,7 @@ export const getIssueBlocksStructure = (block: TIssue): IGanttBlock => { };}; export function getChangedIssuefields(formData: Partial, dirtyFields: { [key: string]: boolean | undefined }) { - const changedFields: Partial = {}; + const changedFields = {} as any; const dirtyFieldKeys = Object.keys(dirtyFields) as (keyof TIssue)[]; for (const dirtyField of dirtyFieldKeys) { @@ -187,7 +187,7 @@ export function getChangedIssuefields(formData: Partial, dirtyFields: { } } - return changedFields; + return changedFields as Partial; } export const formatTextList = (TextArray: string[]): string => { diff --git a/web/hooks/use-group-dragndrop.ts b/web/hooks/use-group-dragndrop.ts index 621a9dc7cf..2364a68212 100644 --- a/web/hooks/use-group-dragndrop.ts +++ b/web/hooks/use-group-dragndrop.ts @@ -65,7 +65,7 @@ export const useGroupIssuesDragNDrop = ( if (isCycleChanged && workspaceSlug) { if (data[cycleKey]) { - addCycleToIssue(workspaceSlug.toString(), projectId, data[cycleKey], issueId).catch(() => + addCycleToIssue(workspaceSlug.toString(), projectId, data[cycleKey] as string, issueId).catch(() => setToast(errorToastProps) ); } else { diff --git a/web/store/issue/helpers/base-issues.store.ts b/web/store/issue/helpers/base-issues.store.ts index 608ddf8b96..e3eeb5ec5f 100644 --- a/web/store/issue/helpers/base-issues.store.ts +++ b/web/store/issue/helpers/base-issues.store.ts @@ -1448,10 +1448,12 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore { // if unGrouped, then return the path as ALL_ISSUES along with orderByUpdates if (!this.issueGroupKey) return action ? [{ path: [ALL_ISSUES], action }, ...orderByUpdates] : orderByUpdates; + const issueGroupValue = issue[this.issueGroupKey] as string | string[] | null | undefined; + const issueGroupValueBeforeUpdate = issueBeforeUpdate?.[this.issueGroupKey] as string | string[] | null | undefined; // if grouped, the get the Difference between the two issue properties (this.issueGroupKey) on which groupBy is performed const groupActionsArray = getDifference( - this.getArrayStringArray(issue[this.issueGroupKey], this.groupBy), - this.getArrayStringArray(issueBeforeUpdate?.[this.issueGroupKey], this.groupBy), + this.getArrayStringArray(issueGroupValue, this.groupBy), + this.getArrayStringArray(issueGroupValueBeforeUpdate, this.groupBy), action ); @@ -1465,10 +1467,16 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore { ...orderByUpdates, ]; + const issueSubGroupValue = issue[this.issueSubGroupKey] as string | string[] | null | undefined; + const issueSubGroupValueBeforeUpdate = issueBeforeUpdate?.[this.issueSubGroupKey] as + | string + | string[] + | null + | undefined; // if subGrouped, the get the Difference between the two issue properties (this.issueGroupKey) on which subGroupBy is performed const subGroupActionsArray = getDifference( - this.getArrayStringArray(issue[this.issueSubGroupKey], this.subGroupBy), - this.getArrayStringArray(issueBeforeUpdate?.[this.issueSubGroupKey], this.subGroupBy), + this.getArrayStringArray(issueSubGroupValue, this.subGroupBy), + this.getArrayStringArray(issueSubGroupValueBeforeUpdate, this.subGroupBy), action ); @@ -1477,13 +1485,10 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore { ...getSubGroupIssueKeyActions( groupActionsArray, subGroupActionsArray, - this.getArrayStringArray(issueBeforeUpdate?.[this.issueGroupKey] ?? issue[this.issueGroupKey], this.groupBy), - this.getArrayStringArray(issue[this.issueGroupKey], this.groupBy), - this.getArrayStringArray( - issueBeforeUpdate?.[this.issueSubGroupKey] ?? issue[this.issueSubGroupKey], - this.subGroupBy - ), - this.getArrayStringArray(issue[this.issueSubGroupKey], this.subGroupBy) + this.getArrayStringArray(issueGroupValueBeforeUpdate ?? issueGroupValue, this.groupBy), + this.getArrayStringArray(issueGroupValue, this.groupBy), + this.getArrayStringArray(issueSubGroupValueBeforeUpdate ?? issueSubGroupValue, this.subGroupBy), + this.getArrayStringArray(issueSubGroupValue, this.subGroupBy) ), ...orderByUpdates, ]; @@ -1511,9 +1516,10 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore { // if they are not equal and issues are not grouped then, provide path as ALL_ISSUES if (!this.issueGroupKey) return [{ path: [ALL_ISSUES], action: EIssueGroupedAction.REORDER }]; + const issueGroupValue = issue[this.issueGroupKey] as string | string[] | null | undefined; // if they are grouped then identify the paths based on props on which group by is dependent on const issueKeyActions: { path: string[]; action: EIssueGroupedAction.REORDER }[] = []; - const groupByValues = this.getArrayStringArray(issue[this.issueGroupKey]); + const groupByValues = this.getArrayStringArray(issueGroupValue); // if issues are not subGrouped then, provide path from groupByValues if (!this.issueSubGroupKey) { @@ -1524,8 +1530,9 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore { return issueKeyActions; } + const issueSubGroupValue = issue[this.issueSubGroupKey] as string | string[] | null | undefined; // if they are grouped then identify the paths based on props on which sub group by is dependent on - const subGroupByValues = this.getArrayStringArray(issue[this.issueSubGroupKey]); + const subGroupByValues = this.getArrayStringArray(issueSubGroupValue); // if issues are subGrouped then, provide path from subGroupByValues for (const groupKey of groupByValues) {