From 6af8f7356fecd3d2fcf8f4ea4da08252ca7f0904 Mon Sep 17 00:00:00 2001 From: olav Date: Wed, 31 Aug 2022 15:09:01 +0200 Subject: [PATCH] fix: avoid stale feature strategy enabled status message (#2018) --- .../FeatureStrategyEnabled/FeatureStrategyEnabled.tsx | 10 +++++++--- .../FeatureStrategyForm/FeatureStrategyForm.tsx | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEnabled/FeatureStrategyEnabled.tsx b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEnabled/FeatureStrategyEnabled.tsx index fbfd976336..3b373074e3 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEnabled/FeatureStrategyEnabled.tsx +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEnabled/FeatureStrategyEnabled.tsx @@ -4,17 +4,21 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit import { Alert } from '@mui/material'; import { IFeatureToggle } from 'interfaces/featureToggle'; import { formatFeaturePath } from '../FeatureStrategyEdit/FeatureStrategyEdit'; +import { useFeature } from 'hooks/api/getters/useFeature/useFeature'; interface IFeatureStrategyEnabledProps { - feature: IFeatureToggle; + projectId: string; + featureId: string; environmentId: string; } export const FeatureStrategyEnabled = ({ - feature, + projectId, + featureId, environmentId, }: IFeatureStrategyEnabledProps) => { - const featurePagePath = formatFeaturePath(feature.project, feature.name); + const featurePagePath = formatFeaturePath(projectId, featureId); + const { feature } = useFeature(projectId, featureId); const featurePageLink = ( diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyForm/FeatureStrategyForm.tsx b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyForm/FeatureStrategyForm.tsx index 0b9eb7b6c2..83d96c97a0 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyForm/FeatureStrategyForm.tsx +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyForm/FeatureStrategyForm.tsx @@ -126,7 +126,8 @@ export const FeatureStrategyForm = ({