-
-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: usage of default strategy #3995
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Boolean(uiConfig.flags.strategyImprovements) && | ||
strategy !== undefined | ||
} | ||
condition={Boolean(uiConfig.flags.strategyImprovements)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify condition
@@ -20,7 +20,7 @@ import { ProjectDefaultStrategyForm } from './ProjectDefaultStrategyForm'; | |||
import { CreateFeatureStrategySchema } from 'openapi'; | |||
import useProject from 'hooks/api/getters/useProject/useProject'; | |||
|
|||
const DEFAULT_STRATEGY = { | |||
export const DEFAULT_STRATEGY = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use globally
@@ -98,7 +99,7 @@ export const FeatureStrategyCreate = () => { | |||
|
|||
useEffect(() => { | |||
if (useDefaultStrategy) { | |||
setStrategy((defaultStrategy as any) || {}); | |||
setStrategy((defaultStrategy as any) || DEFAULT_STRATEGY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user has not defined, use the global default one.
@@ -12,7 +12,8 @@ interface IFeatureStrategyMenuCardProps { | |||
projectId: string; | |||
featureId: string; | |||
environmentId: string; | |||
strategy: IStrategy; | |||
strategy: Pick<IStrategy, 'name' | 'displayName' | 'description'> & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a type alias that could give it a descriptive name why we pick those fields in particular?
Now when user has not defined project default strategy, the default strategy will be used.
Simplify usage and rely on existing constant.