diff --git a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/EnvironmentStrategyExecutionOrder/EnvironmentStrategyExecutionOrder.tsx b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/EnvironmentStrategyExecutionOrder/EnvironmentStrategyExecutionOrder.tsx index 1cebccd3b6cc..135a1c2ce6e1 100644 --- a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/EnvironmentStrategyExecutionOrder/EnvironmentStrategyExecutionOrder.tsx +++ b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/EnvironmentStrategyExecutionOrder/EnvironmentStrategyExecutionOrder.tsx @@ -50,7 +50,10 @@ export const EnvironmentStrategyExecutionOrder = ({ project, actions, }: IEnvironmentStrategyExecutionOrderProps) => { - const { feature: featureData } = useFeature(project, feature); + const { feature: featureData, loading } = useFeature(project, feature); + + if (loading) return null; + const featureEnvironment = featureData.environments.find( ({ name }) => environment === name ); @@ -71,9 +74,11 @@ export const EnvironmentStrategyExecutionOrder = ({ .map(strategy => strategy.id) ?? [], }; - const updatedStrategies = change.payload.map(({ id }) => { - return environmentStrategies.find(s => s.id === id); - }); + const updatedStrategies = change.payload + .map(({ id }) => { + return environmentStrategies.find(s => s.id === id); + }) + .filter(Boolean); const data = { strategyIds: updatedStrategies.map(strategy => strategy!.id),