diff --git a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/ReleasePlanChange.tsx b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/ReleasePlanChange.tsx
index ab879b1272..35f7a9221b 100644
--- a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/ReleasePlanChange.tsx
+++ b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/ReleasePlanChange.tsx
@@ -250,11 +250,7 @@ const CreateMilestoneProgression: FC<{
change: IChangeRequestCreateMilestoneProgression;
currentReleasePlan?: IReleasePlan;
actions?: ReactNode;
- projectId: string;
- environmentName: string;
- featureName: string;
changeRequestState: ChangeRequestState;
- onUpdate?: () => void;
onUpdateChangeRequestSubmit?: (
sourceMilestoneId: string,
payload: UpdateMilestoneProgressionSchema,
@@ -264,11 +260,7 @@ const CreateMilestoneProgression: FC<{
change,
currentReleasePlan,
actions,
- projectId,
- environmentName,
- featureName,
changeRequestState,
- onUpdate,
onUpdateChangeRequestSubmit,
onDeleteChangeRequestSubmit,
}) => {
@@ -358,6 +350,7 @@ const CreateMilestoneProgression: FC<{
milestone.id,
payload,
);
+ return { shouldReset: true };
}}
onDelete={() =>
onDeleteChangeRequestSubmit?.(
@@ -404,11 +397,7 @@ const UpdateMilestoneProgression: FC<{
change: IChangeRequestUpdateMilestoneProgression;
currentReleasePlan?: IReleasePlan;
actions?: ReactNode;
- projectId: string;
- environmentName: string;
- featureName: string;
changeRequestState: ChangeRequestState;
- onUpdate?: () => void;
onUpdateChangeRequestSubmit?: (
sourceMilestoneId: string,
payload: UpdateMilestoneProgressionSchema,
@@ -418,11 +407,7 @@ const UpdateMilestoneProgression: FC<{
change,
currentReleasePlan,
actions,
- projectId,
- environmentName,
- featureName,
changeRequestState,
- onUpdate,
onUpdateChangeRequestSubmit,
onDeleteChangeRequestSubmit,
}) => {
@@ -502,6 +487,7 @@ const UpdateMilestoneProgression: FC<{
milestone.id,
payload,
);
+ return { shouldReset: true };
}}
onDelete={() =>
onDeleteChangeRequestSubmit?.(
@@ -547,11 +533,7 @@ const UpdateMilestoneProgression: FC<{
const ConsolidatedProgressionChanges: FC<{
feature: IChangeRequestFeature;
currentReleasePlan?: IReleasePlan;
- projectId: string;
- environmentName: string;
- featureName: string;
changeRequestState: ChangeRequestState;
- onUpdate?: () => void;
onUpdateChangeRequestSubmit?: (
sourceMilestoneId: string,
payload: UpdateMilestoneProgressionSchema,
@@ -560,11 +542,7 @@ const ConsolidatedProgressionChanges: FC<{
}> = ({
feature,
currentReleasePlan,
- projectId,
- environmentName,
- featureName,
changeRequestState,
- onUpdate,
onUpdateChangeRequestSubmit,
onDeleteChangeRequestSubmit,
}) => {
@@ -766,6 +744,7 @@ const ConsolidatedProgressionChanges: FC<{
displayMilestone.id,
payload,
);
+ return { shouldReset: true };
}}
onDelete={() =>
onDeleteChangeRequestSubmit?.(
@@ -844,13 +823,6 @@ export const ReleasePlanChange: FC<{
usePendingChangeRequests(projectId);
const { setToastData } = useToast();
- const handleUpdate = async () => {
- await refetch();
- if (onRefetch) {
- await onRefetch();
- }
- };
-
const handleUpdateChangeRequestSubmit = async (
sourceMilestoneId: string,
payload: UpdateMilestoneProgressionSchema,
@@ -924,11 +896,7 @@ export const ReleasePlanChange: FC<{
@@ -967,11 +935,7 @@ export const ReleasePlanChange: FC<{
change={change}
currentReleasePlan={currentReleasePlan}
actions={actions}
- projectId={projectId}
- environmentName={environmentName}
- featureName={featureName}
changeRequestState={changeRequestState}
- onUpdate={handleUpdate}
onUpdateChangeRequestSubmit={
handleUpdateChangeRequestSubmit
}
@@ -985,11 +949,7 @@ export const ReleasePlanChange: FC<{
change={change}
currentReleasePlan={currentReleasePlan}
actions={actions}
- projectId={projectId}
- environmentName={environmentName}
- featureName={featureName}
changeRequestState={changeRequestState}
- onUpdate={handleUpdate}
onUpdateChangeRequestSubmit={
handleUpdateChangeRequestSubmit
}
diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx
index 1409bba744..5a6d73feec 100644
--- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx
+++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx
@@ -314,29 +314,19 @@ export const ReleasePlan = ({
});
};
- const handleProgressionSave = async () => {
- setProgressionFormOpenIndex(null);
- await refetch();
- };
-
- const handleProgressionChangeRequestSubmit = (
- payload: CreateMilestoneProgressionSchema,
+ const handleAddToChangeRequest = (
+ action:
+ | {
+ type: 'createMilestoneProgression';
+ payload: CreateMilestoneProgressionSchema;
+ }
+ | {
+ type: 'updateMilestoneProgression';
+ sourceMilestoneId: string;
+ payload: UpdateMilestoneProgressionSchema;
+ },
) => {
- setChangeRequestAction({
- type: 'createMilestoneProgression',
- payload,
- });
- };
-
- const handleUpdateProgressionChangeRequestSubmit = (
- sourceMilestoneId: string,
- payload: UpdateMilestoneProgressionSchema,
- ) => {
- setChangeRequestAction({
- type: 'updateMilestoneProgression',
- sourceMilestoneId,
- payload,
- });
+ setChangeRequestAction(action);
};
const handleDeleteProgression = (milestone: IReleasePlanMilestone) => {
@@ -433,13 +423,7 @@ export const ReleasePlan = ({
}
onStartMilestone={onStartMilestone}
onDeleteProgression={handleDeleteProgression}
- onProgressionSave={handleProgressionSave}
- onProgressionChangeRequestSubmit={
- handleProgressionChangeRequestSubmit
- }
- onUpdateProgressionChangeRequestSubmit={
- handleUpdateProgressionChangeRequestSubmit
- }
+ onAddToChangeRequest={handleAddToChangeRequest}
getPendingProgressionChange={
getPendingProgressionChange
}
diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/MilestoneTransitionDisplay.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/MilestoneTransitionDisplay.tsx
index 9e272d7882..bd5c7904bc 100644
--- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/MilestoneTransitionDisplay.tsx
+++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestone/MilestoneTransitionDisplay.tsx
@@ -9,6 +9,7 @@ import {
getTimeValueAndUnitFromMinutes,
} from '../hooks/useMilestoneProgressionForm.js';
import type { UpdateMilestoneProgressionSchema } from 'openapi';
+import { useEffect } from 'react';
const StyledDisplayContainer = styled('div')(({ theme }) => ({
display: 'flex',
@@ -57,7 +58,9 @@ const StyledButtonGroup = styled('div')(({ theme }) => ({
interface IMilestoneTransitionDisplayProps {
intervalMinutes: number;
- onSave: (payload: UpdateMilestoneProgressionSchema) => Promise;
+ onSave: (
+ payload: UpdateMilestoneProgressionSchema,
+ ) => Promise<{ shouldReset?: boolean }>;
onDelete: () => void;
milestoneName: string;
status?: MilestoneStatus;
@@ -89,6 +92,13 @@ export const MilestoneTransitionDisplay = ({
const showDraftBadge = hasPendingUpdate || hasPendingDelete;
+ // Sync form when intervalMinutes prop changes (e.g., after refetch)
+ useEffect(() => {
+ const newInitial = getTimeValueAndUnitFromMinutes(intervalMinutes);
+ form.setTimeValue(newInitial.value);
+ form.setTimeUnit(newInitial.unit);
+ }, [intervalMinutes]);
+
const handleSave = async () => {
if (!hasChanged) return;
@@ -98,9 +108,13 @@ export const MilestoneTransitionDisplay = ({
},
};
- await onSave(payload);
- // Reset the form after save
- handleReset();
+ const result = await onSave(payload);
+
+ // If change request, reset to current saved value
+ // Otherwise, form will automatically sync when intervalMinutes prop updates after refetch
+ if (result?.shouldReset) {
+ handleReset();
+ }
};
const handleReset = () => {
diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx
index cfc84c170f..5d224e0247 100644
--- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx
+++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlanMilestoneItem/ReleasePlanMilestoneItem.tsx
@@ -84,13 +84,17 @@ interface IReleasePlanMilestoneItemProps {
// API callbacks
onStartMilestone?: (milestone: IReleasePlanMilestone) => void;
onDeleteProgression: (milestone: IReleasePlanMilestone) => void;
- onProgressionSave: () => Promise;
- onProgressionChangeRequestSubmit: (
- payload: CreateMilestoneProgressionSchema,
- ) => void;
- onUpdateProgressionChangeRequestSubmit: (
- sourceMilestoneId: string,
- payload: UpdateMilestoneProgressionSchema,
+ onAddToChangeRequest: (
+ action:
+ | {
+ type: 'createMilestoneProgression';
+ payload: CreateMilestoneProgressionSchema;
+ }
+ | {
+ type: 'updateMilestoneProgression';
+ sourceMilestoneId: string;
+ payload: UpdateMilestoneProgressionSchema;
+ },
) => void;
// Context
@@ -103,7 +107,7 @@ interface IReleasePlanMilestoneItemProps {
environment: string;
featureName: string;
- onUpdate: () => void;
+ onUpdate: () => void | Promise;
}
export const ReleasePlanMilestoneItem = ({
@@ -119,9 +123,7 @@ export const ReleasePlanMilestoneItem = ({
onSetProgressionFormOpenIndex,
onStartMilestone,
onDeleteProgression,
- onProgressionSave,
- onProgressionChangeRequestSubmit,
- onUpdateProgressionChangeRequestSubmit,
+ onAddToChangeRequest,
getPendingProgressionChange,
projectId,
environment,
@@ -146,7 +148,10 @@ export const ReleasePlanMilestoneItem = ({
payload: CreateMilestoneProgressionSchema,
) => {
if (isChangeRequestConfigured(environment)) {
- onProgressionChangeRequestSubmit(payload);
+ onAddToChangeRequest({
+ type: 'createMilestoneProgression',
+ payload,
+ });
handleCloseProgressionForm();
return;
}
@@ -162,7 +167,8 @@ export const ReleasePlanMilestoneItem = ({
type: 'success',
text: 'Automation configured successfully',
});
- await onProgressionSave();
+ handleCloseProgressionForm();
+ await onUpdate();
} catch (error: unknown) {
setToastApiError(formatUnknownError(error));
}
@@ -171,10 +177,15 @@ export const ReleasePlanMilestoneItem = ({
// Unified handler for updating progression
const handleUpdateProgression = async (
payload: UpdateMilestoneProgressionSchema,
- ) => {
+ ): Promise<{ shouldReset?: boolean }> => {
if (isChangeRequestConfigured(environment)) {
- onUpdateProgressionChangeRequestSubmit(milestone.id, payload);
- return;
+ onAddToChangeRequest({
+ type: 'updateMilestoneProgression',
+ sourceMilestoneId: milestone.id,
+ payload,
+ });
+ // Return shouldReset=true for change requests so form resets to current value
+ return { shouldReset: true };
}
try {
@@ -190,8 +201,11 @@ export const ReleasePlanMilestoneItem = ({
text: 'Automation updated successfully',
});
await onUpdate();
+ // Return empty object for direct updates - form will sync via useEffect
+ return {};
} catch (error: unknown) {
setToastApiError(formatUnknownError(error));
+ return {};
}
};