Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add more checks to possibly fix sentry issues #4233

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions web/components/issues/issue-detail/label/create-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion web/components/issues/issue-modal/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion web/helpers/array.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion web/store/issue/draft/issue.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions web/store/issue/issue-details/sub_issues.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion web/store/label.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Loading