From f881103701cdb06d3fdbb6bd7d3dabff096c8039 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Wed, 23 Aug 2023 12:17:59 +0200 Subject: [PATCH] fix: diff component for ordering (#4552) --- .../EnvironmentStrategyExecutionOrder.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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),