mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
Add more checks to possibly fix sentry issues
This commit is contained in:
parent
7da2cb143f
commit
e1f20361b6
@ -67,6 +67,8 @@ export const LabelCreate: FC<ILabelCreate> = (props) => {
|
||||
|
||||
try {
|
||||
const labelResponse = await labelOperations.createLabel(workspaceSlug, projectId, formData);
|
||||
if (!labelResponse) throw Error;
|
||||
|
||||
const currentLabels = [...(values || []), labelResponse.id];
|
||||
await labelOperations.updateIssue(workspaceSlug, projectId, issueId, { label_ids: currentLabels });
|
||||
handleIsCreateToggle();
|
||||
|
@ -182,7 +182,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
};
|
||||
|
||||
// this condition helps to move the issues from draft to project issues
|
||||
if (formData.hasOwnProperty("is_draft")) submitData.is_draft = formData.is_draft;
|
||||
if (formData?.hasOwnProperty("is_draft")) submitData.is_draft = formData.is_draft;
|
||||
|
||||
await onSubmit(submitData, is_draft_issue);
|
||||
|
||||
|
@ -66,7 +66,7 @@ export const sortByField = (array: any[], field: string): any[] =>
|
||||
|
||||
export const orderGroupedDataByField = <T>(groupedData: GroupedItems<T>, orderBy: keyof T): GroupedItems<T> => {
|
||||
for (const key in groupedData) {
|
||||
if (groupedData.hasOwnProperty(key)) {
|
||||
if (groupedData?.hasOwnProperty(key)) {
|
||||
groupedData[key] = groupedData[key].sort((a, b) => {
|
||||
if (a[orderBy] < b[orderBy]) return -1;
|
||||
if (a[orderBy] > b[orderBy]) return 1;
|
||||
|
@ -168,7 +168,7 @@ export class DraftIssues extends IssueHelperStore implements IDraftIssues {
|
||||
try {
|
||||
this.rootStore.issues.updateIssue(issueId, data);
|
||||
|
||||
if (data.hasOwnProperty("is_draft") && data?.is_draft === false) {
|
||||
if (data?.hasOwnProperty("is_draft") && data?.is_draft === false) {
|
||||
runInAction(() => {
|
||||
update(this.issues, [projectId], (issueIds = []) => {
|
||||
if (issueIds.includes(issueId)) pull(issueIds, issueId);
|
||||
|
@ -199,7 +199,7 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
||||
);
|
||||
|
||||
// parent update
|
||||
if (issueData.hasOwnProperty("parent_id") && issueData.parent_id !== oldIssue.parent_id) {
|
||||
if (issueData?.hasOwnProperty("parent_id") && issueData.parent_id !== oldIssue.parent_id) {
|
||||
runInAction(() => {
|
||||
if (oldIssue.parent_id) pull(this.subIssues[oldIssue.parent_id], issueId);
|
||||
if (issueData.parent_id)
|
||||
@ -208,7 +208,7 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
||||
}
|
||||
|
||||
// state update
|
||||
if (issueData.hasOwnProperty("state_id") && issueData.state_id !== oldIssue.state_id) {
|
||||
if (issueData?.hasOwnProperty("state_id") && issueData.state_id !== oldIssue.state_id) {
|
||||
let oldIssueStateGroup: string | undefined = undefined;
|
||||
let issueStateGroup: string | undefined = undefined;
|
||||
|
||||
|
@ -168,7 +168,7 @@ export class LabelStore implements ILabelStore {
|
||||
createLabel = async (workspaceSlug: string, projectId: string, data: Partial<IIssueLabel>) =>
|
||||
await this.issueLabelService.createIssueLabel(workspaceSlug, projectId, data).then((response) => {
|
||||
runInAction(() => {
|
||||
set(this.labelMap, [response.id], response);
|
||||
response && set(this.labelMap, [response.id], response);
|
||||
});
|
||||
return response;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user