Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-2363] fix: Error while updating issue in cycles (#5478)

rahulrameshabcd08b3159b1
diff --git a/web/core/components/inbox/content/inbox-issue-header.tsx b/web/core/components/inbox/content/inbox-issue-header.tsx
index 6a7978bd40..114a5134d1 100644
--- a/web/core/components/inbox/content/inbox-issue-header.tsx
+++ b/web/core/components/inbox/content/inbox-issue-header.tsx
@@ -370,7 +370,6 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
</div>
</CustomMenu.MenuItem>
)}
-
</CustomMenu>
)}
</>
diff --git a/web/core/store/issue/cycle/issue.store.ts b/web/core/store/issue/cycle/issue.store.ts
index 7f6ac53ec2..6180449d0d 100644
--- a/web/core/store/issue/cycle/issue.store.ts
+++ b/web/core/store/issue/cycle/issue.store.ts
@@ -142,16 +142,20 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
};
updateParentStats = (prevIssueState?: TIssue, nextIssueState?: TIssue, id?: string | undefined) => {
- const distributionUpdates = getDistributionPathsPostUpdate(
- prevIssueState,
- nextIssueState,
- this.rootIssueStore.rootStore.state.stateMap,
- this.rootIssueStore.rootStore.projectEstimate?.currentActiveEstimate?.estimatePointById
- );
+ try {
+ const distributionUpdates = getDistributionPathsPostUpdate(
+ prevIssueState,
+ nextIssueState,
+ this.rootIssueStore.rootStore.state.stateMap,
+ this.rootIssueStore.rootStore.projectEstimate?.currentActiveEstimate?.estimatePointById
+ );
- const cycleId = id ?? this.cycleId;
+ const cycleId = id ?? this.cycleId;
- cycleId && this.rootIssueStore.rootStore.cycle.updateCycleDistribution(distributionUpdates, cycleId);
+ cycleId && this.rootIssueStore.rootStore.cycle.updateCycleDistribution(distributionUpdates, cycleId);
+ } catch (e) {
+ console.warn("could not update cycle statistics");
+ }
};
/**
diff --git a/web/core/store/issue/module/issue.store.ts b/web/core/store/issue/module/issue.store.ts
index 266c9d6614..9131c8833f 100644
--- a/web/core/store/issue/module/issue.store.ts
+++ b/web/core/store/issue/module/issue.store.ts
@@ -98,17 +98,21 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
* @param id
*/
updateParentStats = (prevIssueState?: TIssue, nextIssueState?: TIssue, id?: string | undefined) => {
- // get distribution updates
- const distributionUpdates = getDistributionPathsPostUpdate(
- prevIssueState,
- nextIssueState,
- this.rootIssueStore.rootStore.state.stateMap,
- this.rootIssueStore.rootStore.projectEstimate?.currentActiveEstimate?.estimatePointById
- );
+ try {
+ // get distribution updates
+ const distributionUpdates = getDistributionPathsPostUpdate(
+ prevIssueState,
+ nextIssueState,
+ this.rootIssueStore.rootStore.state.stateMap,
+ this.rootIssueStore.rootStore.projectEstimate?.currentActiveEstimate?.estimatePointById
+ );
- const moduleId = id ?? this.moduleId;
+ const moduleId = id ?? this.moduleId;
- moduleId && this.rootIssueStore.rootStore.module.updateModuleDistribution(distributionUpdates, moduleId);
+ moduleId && this.rootIssueStore.rootStore.module.updateModuleDistribution(distributionUpdates, moduleId);
+ } catch (e) {
+ console.warn("could not update module statistics");
+ }
};
/**
diff --git a/web/helpers/distribution-update.helper.ts b/web/helpers/distribution-update.helper.ts
index 5fdd09a8c9..c55543fee7 100644
--- a/web/helpers/distribution-update.helper.ts
+++ b/web/helpers/distribution-update.helper.ts
@@ -242,21 +242,27 @@ export const updateDistribution = (distributionObject: ICycle | IModule, distrib
const { id } = assigneeUpdate;
// find and update the assignee issue counts
- const issuesAssignee = distributionObject.distribution?.assignees?.find((assignee) => assignee.assignee_id === id);
- if (issuesAssignee) {
- issuesAssignee.completed_issues += assigneeUpdate.completed_issues ?? 0;
- issuesAssignee.pending_issues += assigneeUpdate.pending_issues ?? 0;
- issuesAssignee.total_issues += assigneeUpdate.total_issues;
+ if (Array.isArray(distributionObject.distribution?.assignees)) {
+ const issuesAssignee = distributionObject.distribution?.assignees?.find(
+ (assignee) => assignee.assignee_id === id
+ );
+ if (issuesAssignee) {
+ issuesAssignee.completed_issues += assigneeUpdate.completed_issues ?? 0;
+ issuesAssignee.pending_issues += assigneeUpdate.pending_issues ?? 0;
+ issuesAssignee.total_issues += assigneeUpdate.total_issues;
+ }
}
// find and update the assignee points
- const pointsAssignee = distributionObject.estimate_distribution?.assignees?.find(
- (assignee) => assignee.assignee_id === id
- );
- if (pointsAssignee) {
- pointsAssignee.completed_estimates += assigneeUpdate.completed_estimates ?? 0;
- pointsAssignee.pending_estimates += assigneeUpdate.pending_estimates ?? 0;
- pointsAssignee.total_estimates += assigneeUpdate.total_estimates;
+ if (Array.isArray(distributionObject.estimate_distribution?.assignees)) {
+ const pointsAssignee = distributionObject.estimate_distribution?.assignees?.find(
+ (assignee) => assignee.assignee_id === id
+ );
+ if (pointsAssignee) {
+ pointsAssignee.completed_estimates += assigneeUpdate.completed_estimates ?? 0;
+ pointsAssignee.pending_estimates += assigneeUpdate.pending_estimates ?? 0;
+ pointsAssignee.total_estimates += assigneeUpdate.total_estimates;
+ }
}
}
@@ -264,19 +270,23 @@ export const updateDistribution = (distributionObject: ICycle | IModule, distrib
const { id } = labelUpdate;
// find and update the label issue counts
- const issuesLabel = distributionObject.distribution?.labels?.find((label) => label.label_id === id);
- if (issuesLabel) {
- issuesLabel.completed_issues += labelUpdate.completed_issues ?? 0;
- issuesLabel.pending_issues += labelUpdate.pending_issues ?? 0;
- issuesLabel.total_issues += labelUpdate.total_issues;
+ if (Array.isArray(distributionObject.distribution?.labels)) {
+ const issuesLabel = distributionObject.distribution?.labels?.find((label) => label.label_id === id);
+ if (issuesLabel) {
+ issuesLabel.completed_issues += labelUpdate.completed_issues ?? 0;
+ issuesLabel.pending_issues += labelUpdate.pending_issues ?? 0;
+ issuesLabel.total_issues += labelUpdate.total_issues;
+ }
}
// find and update the label points
- const pointsLabel = distributionObject.estimate_distribution?.labels?.find((label) => label.label_id === id);
- if (pointsLabel) {
- pointsLabel.completed_estimates += labelUpdate.completed_estimates ?? 0;
- pointsLabel.pending_estimates += labelUpdate.pending_estimates ?? 0;
- pointsLabel.total_estimates += labelUpdate.total_estimates;
+ if (Array.isArray(distributionObject.estimate_distribution?.labels)) {
+ const pointsLabel = distributionObject.estimate_distribution?.labels?.find((label) => label.label_id === id);
+ if (pointsLabel) {
+ pointsLabel.completed_estimates += labelUpdate.completed_estimates ?? 0;
+ pointsLabel.pending_estimates += labelUpdate.pending_estimates ?? 0;
+ pointsLabel.total_estimates += labelUpdate.total_estimates;
+ }
}
}
};