mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-27 11:02:16 +01:00
refactor: remove uneccesary type
This commit is contained in:
parent
2dcd818e31
commit
3b75ad4e72
@ -54,7 +54,7 @@ export const ProgressionChange: FC<ProgressionChangeProps> = ({
|
||||
|
||||
const sourceId = isCreate
|
||||
? change.payload.sourceMilestone
|
||||
: change.payload.sourceMilestoneId || change.payload.sourceMilestone;
|
||||
: change.payload.sourceMilestoneId;
|
||||
|
||||
if (!sourceId) return null;
|
||||
|
||||
|
||||
@ -239,7 +239,6 @@ const AddReleasePlan: FC<{
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
const ConsolidatedProgressionChanges: FC<{
|
||||
feature: IChangeRequestFeature;
|
||||
currentReleasePlan?: IReleasePlan;
|
||||
@ -312,8 +311,7 @@ const ConsolidatedProgressionChanges: FC<{
|
||||
.map((change) =>
|
||||
change.action === 'createMilestoneProgression'
|
||||
? change.payload.sourceMilestone
|
||||
: change.payload.sourceMilestoneId ||
|
||||
change.payload.sourceMilestone,
|
||||
: change.payload.sourceMilestoneId,
|
||||
)
|
||||
.filter((id): id is string => Boolean(id)),
|
||||
);
|
||||
@ -321,11 +319,7 @@ const ConsolidatedProgressionChanges: FC<{
|
||||
const milestonesWithDeletedAutomation = new Set(
|
||||
progressionChanges
|
||||
.filter((change) => change.action === 'deleteMilestoneProgression')
|
||||
.map(
|
||||
(change) =>
|
||||
change.payload.sourceMilestoneId ||
|
||||
change.payload.sourceMilestone,
|
||||
)
|
||||
.map((change) => change.payload.sourceMilestoneId)
|
||||
.filter((id): id is string => Boolean(id)),
|
||||
);
|
||||
|
||||
@ -333,8 +327,7 @@ const ConsolidatedProgressionChanges: FC<{
|
||||
const sourceId =
|
||||
change.action === 'createMilestoneProgression'
|
||||
? change.payload.sourceMilestone
|
||||
: change.payload.sourceMilestoneId ||
|
||||
change.payload.sourceMilestone;
|
||||
: change.payload.sourceMilestoneId;
|
||||
const sourceName =
|
||||
basePlan.milestones.find((milestone) => milestone.id === sourceId)
|
||||
?.name || sourceId;
|
||||
|
||||
@ -17,7 +17,6 @@ export const useModifiedReleasePlan = (
|
||||
return {
|
||||
...basePlan,
|
||||
milestones: basePlan.milestones.map((milestone) => {
|
||||
// Find if there's a progression change for this milestone
|
||||
const createChange = progressionChanges.find(
|
||||
(change): change is IChangeRequestCreateMilestoneProgression =>
|
||||
change.action === 'createMilestoneProgression' &&
|
||||
@ -26,31 +25,14 @@ export const useModifiedReleasePlan = (
|
||||
const updateChange = progressionChanges.find(
|
||||
(change): change is IChangeRequestUpdateMilestoneProgression =>
|
||||
change.action === 'updateMilestoneProgression' &&
|
||||
(change.payload.sourceMilestoneId === milestone.id ||
|
||||
change.payload.sourceMilestone === milestone.id),
|
||||
change.payload.sourceMilestoneId === milestone.id,
|
||||
);
|
||||
const deleteChange = progressionChanges.find(
|
||||
(change): change is IChangeRequestDeleteMilestoneProgression =>
|
||||
change.action === 'deleteMilestoneProgression' &&
|
||||
(change.payload.sourceMilestoneId === milestone.id ||
|
||||
change.payload.sourceMilestone === milestone.id),
|
||||
change.payload.sourceMilestoneId === milestone.id,
|
||||
);
|
||||
|
||||
// Check for conflicting changes (delete + create/update for same milestone)
|
||||
if (deleteChange && (createChange || updateChange)) {
|
||||
console.warn(
|
||||
'[useModifiedReleasePlan] Conflicting changes detected for milestone:',
|
||||
{
|
||||
milestone: milestone.name,
|
||||
hasCreate: !!createChange,
|
||||
hasUpdate: !!updateChange,
|
||||
hasDelete: !!deleteChange,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// If there's a delete change, remove the transition condition
|
||||
// Delete takes precedence over create/update
|
||||
if (deleteChange) {
|
||||
return {
|
||||
...milestone,
|
||||
|
||||
@ -304,13 +304,11 @@ type ChangeRequestCreateMilestoneProgression =
|
||||
type ChangeRequestUpdateMilestoneProgression =
|
||||
UpdateMilestoneProgressionSchema & {
|
||||
sourceMilestoneId?: string;
|
||||
sourceMilestone?: string; // Backward compatibility for existing change requests
|
||||
snapshot?: IReleasePlan;
|
||||
};
|
||||
|
||||
type ChangeRequestDeleteMilestoneProgression = {
|
||||
sourceMilestoneId?: string;
|
||||
sourceMilestone?: string; // Backward compatibility for existing change requests
|
||||
snapshot?: IReleasePlan;
|
||||
};
|
||||
|
||||
|
||||
@ -146,15 +146,10 @@ export const ReleasePlan = ({
|
||||
const progressionChange = featureInChangeRequest.changes.find(
|
||||
(change: any) =>
|
||||
(change.action === 'updateMilestoneProgression' &&
|
||||
(change.payload.sourceMilestoneId ===
|
||||
sourceMilestoneId ||
|
||||
change.payload.sourceMilestone ===
|
||||
sourceMilestoneId)) ||
|
||||
change.payload.sourceMilestoneId ===
|
||||
sourceMilestoneId) ||
|
||||
(change.action === 'deleteMilestoneProgression' &&
|
||||
(change.payload.sourceMilestoneId ===
|
||||
sourceMilestoneId ||
|
||||
change.payload.sourceMilestone ===
|
||||
sourceMilestoneId)),
|
||||
change.payload.sourceMilestoneId === sourceMilestoneId),
|
||||
);
|
||||
|
||||
if (progressionChange) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user