mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: new strategy using default strategy (#7075)
This commit is contained in:
		
							parent
							
								
									dfc0c3c63f
								
							
						
					
					
						commit
						50ee7fa779
					
				@ -119,6 +119,7 @@ export const FeatureStrategyCreate = () => {
 | 
			
		||||
    }, [
 | 
			
		||||
        featureId,
 | 
			
		||||
        JSON.stringify(strategyDefinition),
 | 
			
		||||
        JSON.stringify(defaultStrategy),
 | 
			
		||||
        shouldUseDefaultStrategy,
 | 
			
		||||
    ]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ const RenderFallbackStrategy = () => {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
test('should render default strategy from project', async () => {
 | 
			
		||||
    testServerRoute(server, '/api/admin/projects/default', {
 | 
			
		||||
    testServerRoute(server, '/api/admin/projects/default/overview', {
 | 
			
		||||
        environments: [
 | 
			
		||||
            {
 | 
			
		||||
                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 () => {
 | 
			
		||||
    testServerRoute(server, '/api/admin/projects/default', {
 | 
			
		||||
    testServerRoute(server, '/api/admin/projects/default/overview', {
 | 
			
		||||
        defaultStickiness: 'clientId',
 | 
			
		||||
        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 () => {
 | 
			
		||||
    testServerRoute(server, '/api/admin/projects/default', {
 | 
			
		||||
    testServerRoute(server, '/api/admin/projects/default/overview', {
 | 
			
		||||
        environments: [],
 | 
			
		||||
    });
 | 
			
		||||
    render(<RenderFallbackStrategy />);
 | 
			
		||||
 | 
			
		||||
@ -18,14 +18,13 @@ import useProjectApi from 'hooks/api/actions/useProjectApi/useProjectApi';
 | 
			
		||||
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,
 | 
			
		||||
    environmentId: string,
 | 
			
		||||
) => {
 | 
			
		||||
    const { project, refetch } = useProject(projectId);
 | 
			
		||||
    const { project, refetch } = useProjectOverview(projectId);
 | 
			
		||||
 | 
			
		||||
    const defaultStrategyFallback = {
 | 
			
		||||
        name: 'flexibleRollout',
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user