1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-01 01:18:10 +02:00

fix: new strategy using default strategy (#7075)

This commit is contained in:
Mateusz Kwasniewski 2024-05-20 09:50:44 +02:00 committed by GitHub
parent dfc0c3c63f
commit 50ee7fa779
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -119,6 +119,7 @@ export const FeatureStrategyCreate = () => {
}, [ }, [
featureId, featureId,
JSON.stringify(strategyDefinition), JSON.stringify(strategyDefinition),
JSON.stringify(defaultStrategy),
shouldUseDefaultStrategy, shouldUseDefaultStrategy,
]); ]);

View File

@ -21,7 +21,7 @@ const RenderFallbackStrategy = () => {
}; };
test('should render default strategy from project', async () => { test('should render default strategy from project', async () => {
testServerRoute(server, '/api/admin/projects/default', { testServerRoute(server, '/api/admin/projects/default/overview', {
environments: [ environments: [
{ {
environment: 'development', environment: 'development',
@ -35,7 +35,7 @@ test('should render default strategy from project', async () => {
}); });
test('should render fallback default strategy with project default stickiness', async () => { test('should render fallback default strategy with project default stickiness', async () => {
testServerRoute(server, '/api/admin/projects/default', { testServerRoute(server, '/api/admin/projects/default/overview', {
defaultStickiness: 'clientId', defaultStickiness: 'clientId',
environments: [], environments: [],
}); });
@ -45,7 +45,7 @@ test('should render fallback default strategy with project default stickiness',
}); });
test('should render fallback default strategy with no project default stickiness', async () => { test('should render fallback default strategy with no project default stickiness', async () => {
testServerRoute(server, '/api/admin/projects/default', { testServerRoute(server, '/api/admin/projects/default/overview', {
environments: [], environments: [],
}); });
render(<RenderFallbackStrategy />); render(<RenderFallbackStrategy />);

View File

@ -18,14 +18,13 @@ import useProjectApi from 'hooks/api/actions/useProjectApi/useProjectApi';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import { ProjectDefaultStrategyForm } from './ProjectDefaultStrategyForm'; import { ProjectDefaultStrategyForm } from './ProjectDefaultStrategyForm';
import type { CreateFeatureStrategySchema } from 'openapi'; import type { CreateFeatureStrategySchema } from 'openapi';
import useProject from 'hooks/api/getters/useProject/useProject';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview'; import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
export const useDefaultStrategy = ( export const useDefaultStrategy = (
projectId: string, projectId: string,
environmentId: string, environmentId: string,
) => { ) => {
const { project, refetch } = useProject(projectId); const { project, refetch } = useProjectOverview(projectId);
const defaultStrategyFallback = { const defaultStrategyFallback = {
name: 'flexibleRollout', name: 'flexibleRollout',