1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: default strategy ui update fix (#6652)

This PR fixes a bug where editing the default strategy would not refresh
the resource it was depending on to display the data. This also surfaces
another issue, which is that project settings is using data from the
getProjectOverview hook to display the default strategies in each
environment. This should be it's own resource, but that is beyond the
scope of this PR.
This commit is contained in:
Fredrik Strand Oseberg 2024-03-21 15:13:23 +01:00 committed by GitHub
parent 9233d4ca33
commit 8532e08398
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,7 @@ import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import { ProjectDefaultStrategyForm } from './ProjectDefaultStrategyForm';
import type { CreateFeatureStrategySchema } from 'openapi';
import useProject from 'hooks/api/getters/useProject/useProject';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
export const useDefaultStrategy = (
projectId: string,
@ -46,6 +47,7 @@ export const useDefaultStrategy = (
const EditDefaultStrategy = () => {
const projectId = useRequiredPathParam('projectId');
const environmentId = useRequiredQueryParam('environmentId');
const { refetch: refetchProjectOverview } = useProjectOverview(projectId);
const {
defaultStrategyFallback,
@ -102,7 +104,8 @@ const EditDefaultStrategy = () => {
},
});
await refetchSavedStrategySegments();
refetchSavedStrategySegments();
refetchProjectOverview();
setToastData({
title: 'Default Strategy updated',
type: 'success',