1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: refetch immutable toggle when adding strategy (#1164)

This commit is contained in:
Tymoteusz Czech 2022-07-28 13:45:08 +02:00 committed by GitHub
parent 850c7a26db
commit c79465e7d9
3 changed files with 12 additions and 1 deletions

View File

@ -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%'}
</div>
);
}

View File

@ -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',

View File

@ -50,6 +50,7 @@ export const StrategyExecution = ({ strategy }: IStrategyExecutionProps) => {
sx={{ display: 'flex', alignItems: 'center' }}
>
<PercentageCircle
hideNumber
percentage={parseParameterNumber(
parameters[key]
)}