Skip to content
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

Merged
merged 2 commits into from
Jun 19, 2023
Merged

fix: usage of default strategy #3995

merged 2 commits into from
Jun 19, 2023

Conversation

sjaanus
Copy link
Contributor

@sjaanus sjaanus commented Jun 15, 2023

Now when user has not defined project default strategy, the default strategy will be used.
Simplify usage and rely on existing constant.

@vercel
Copy link

vercel bot commented Jun 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2023 1:06pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Jun 15, 2023 1:06pm

Boolean(uiConfig.flags.strategyImprovements) &&
strategy !== undefined
}
condition={Boolean(uiConfig.flags.strategyImprovements)}
Copy link
Contributor Author

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 = {
Copy link
Contributor Author

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);
Copy link
Contributor Author

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'> &
Copy link
Contributor

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?

@sjaanus sjaanus merged commit 60f4ce3 into main Jun 19, 2023
14 of 19 checks passed
@sjaanus sjaanus deleted the fix-default-strat branch June 19, 2023 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants