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.

fix: estimate order not maintained in create/ update modal. (#3326)

Prateek Shourya12a33927225b
diff --git a/web/components/estimates/estimates-list.tsx b/web/components/estimates/estimates-list.tsx
index 05b174461d..e226e17e02 100644
--- a/web/components/estimates/estimates-list.tsx
+++ b/web/components/estimates/estimates-list.tsx
@@ -14,6 +14,8 @@ import { EmptyState } from "components/common";
import emptyEstimate from "public/empty-state/estimate.svg";
// types
import { IEstimate } from "@plane/types";
+// helpers
+import { orderArrayBy } from "helpers/array.helper";
export const EstimatesList: React.FC = observer(() => {
// states
@@ -31,7 +33,11 @@ export const EstimatesList: React.FC = observer(() => {
const editEstimate = (estimate: IEstimate) => {
setEstimateFormOpen(true);
- setEstimateToUpdate(estimate);
+ // Order the points array by key before updating the estimate to update state
+ setEstimateToUpdate({
+ ...estimate,
+ points: orderArrayBy(estimate.points, "key"),
+ });
};
const disableEstimates = () => {
diff --git a/web/store/estimate.store.ts b/web/store/estimate.store.ts
index 19a05b5441..0dd90671f1 100644
--- a/web/store/estimate.store.ts
+++ b/web/store/estimate.store.ts
@@ -172,7 +172,7 @@ export class EstimateStore implements IEstimateStore {
updateEstimate = async (workspaceSlug: string, projectId: string, estimateId: string, data: IEstimateFormData) =>
await this.estimateService.patchEstimate(workspaceSlug, projectId, estimateId, data).then((response) => {
const updatedEstimates = (this.estimates?.[projectId] ?? []).map((estimate) =>
- estimate.id === estimateId ? { ...estimate, ...data.estimate } : estimate
+ estimate.id === estimateId ? { ...estimate, ...data.estimate, points: [...data.estimate_points] } : estimate
);
runInAction(() => {
set(this.estimates, projectId, updatedEstimates);