forked from github/plane
fix: estimate order not maintained in create/ update modal. (#3326)
* fix: estimate order not maintained in create/ update modal. * fix: estimate points mutation on update.
This commit is contained in:
parent
b62a1b11b1
commit
12a3392722
@ -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 = () => {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user