From c79465e7d9ed9574fa4a42bae6001e4fde0a403d Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Thu, 28 Jul 2022 13:45:08 +0200 Subject: [PATCH] fix: refetch immutable toggle when adding strategy (#1164) --- .../component/common/PercentageCircle/PercentageCircle.tsx | 5 ++++- .../FeatureStrategyEmpty/FeatureStrategyEmpty.tsx | 7 +++++++ .../StrategyItem/StrategyExecution/StrategyExecution.tsx | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/common/PercentageCircle/PercentageCircle.tsx b/frontend/src/component/common/PercentageCircle/PercentageCircle.tsx index ecf2b9948e..0a21250267 100644 --- a/frontend/src/component/common/PercentageCircle/PercentageCircle.tsx +++ b/frontend/src/component/common/PercentageCircle/PercentageCircle.tsx @@ -5,12 +5,14 @@ interface IPercentageCircleProps { percentage: number; secondaryPieColor?: string; className?: string; + hideNumber?: boolean; } const PercentageCircle = ({ styles, percentage, secondaryPieColor, + hideNumber, ...rest }: IPercentageCircleProps) => { const theme = useTheme(); @@ -35,9 +37,10 @@ const PercentageCircle = ({ display: 'flex', justifyContent: 'center', alignItems: 'center', + fontSize: '12px', }} > - 100% + {hideNumber ? null : '100%'} ); } diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty.tsx b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty.tsx index 060b9a6dc4..01d24e8cd1 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty.tsx +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEmpty/FeatureStrategyEmpty.tsx @@ -8,6 +8,7 @@ import { FeatureStrategyMenu } from '../FeatureStrategyMenu/FeatureStrategyMenu' import { PresetCard } from './PresetCard/PresetCard'; import { useStyles } from './FeatureStrategyEmpty.styles'; import { formatUnknownError } from 'utils/formatUnknownError'; +import { useFeatureImmutable } from 'hooks/api/getters/useFeature/useFeatureImmutable'; import { getFeatureStrategyIcon } from 'utils/strategyNames'; interface IFeatureStrategyEmptyProps { @@ -25,9 +26,15 @@ export const FeatureStrategyEmpty = ({ const { addStrategyToFeature } = useFeatureStrategyApi(); const { setToastData, setToastApiError } = useToast(); const { refetchFeature } = useFeature(projectId, featureId); + const { refetchFeature: refetchFeatureImmutable } = useFeatureImmutable( + projectId, + featureId + ); const onAfterAddStrategy = () => { refetchFeature(); + refetchFeatureImmutable(); + setToastData({ title: 'Strategy created', text: 'Successfully created strategy', diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyItem/StrategyExecution/StrategyExecution.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyItem/StrategyExecution/StrategyExecution.tsx index 804615d3fa..380ba8c3c4 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyItem/StrategyExecution/StrategyExecution.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/EnvironmentAccordionBody/StrategyDraggableItem/StrategyItem/StrategyExecution/StrategyExecution.tsx @@ -50,6 +50,7 @@ export const StrategyExecution = ({ strategy }: IStrategyExecutionProps) => { sx={{ display: 'flex', alignItems: 'center' }} >