-
-
Notifications
You must be signed in to change notification settings - Fork 736
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
chore: remove workaround #6942
chore: remove workaround #6942
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
if (newProject.changeRequestEnvironments) { | ||
await this.validateEnvironmentsExist( | ||
newProject.changeRequestEnvironments.map((env) => env.name), | ||
); | ||
const changeRequestEnvironments = | ||
await enableChangeRequestsForSpecifiedEnvironments( | ||
newProject.changeRequestEnvironments, | ||
); | ||
|
||
data.changeRequestEnvironments = changeRequestEnvironments; | ||
} else { | ||
data.changeRequestEnvironments = []; | ||
} |
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.
As mentioned in the description, this could be this instead (essentially the same as before, but without the comment and without extra set of ??
s. Happy to hear your thoughts.
if (newProject.changeRequestEnvironments) { | |
await this.validateEnvironmentsExist( | |
newProject.changeRequestEnvironments.map((env) => env.name), | |
); | |
const changeRequestEnvironments = | |
await enableChangeRequestsForSpecifiedEnvironments( | |
newProject.changeRequestEnvironments, | |
); | |
data.changeRequestEnvironments = changeRequestEnvironments; | |
} else { | |
data.changeRequestEnvironments = []; | |
} | |
const crEnvs = newProject.changeRequestEnvironments ?? [] | |
await this.validateEnvironmentsExist(crEnvs.map((env) => env.name)); | |
const changeRequestEnvironments = | |
await enableChangeRequestsForSpecifiedEnvironments(crEnvs,); | |
data.changeRequestEnvironments = changeRequestEnvironments; |
I kinda like this version, because it avoids all the nesting and it reads cleaner to me 🤷🏼
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.
More verbose version looks more readable
if (newProject.changeRequestEnvironments) { | ||
await this.validateEnvironmentsExist( | ||
newProject.changeRequestEnvironments.map((env) => env.name), | ||
); | ||
const changeRequestEnvironments = | ||
await enableChangeRequestsForSpecifiedEnvironments( | ||
newProject.changeRequestEnvironments, | ||
); | ||
|
||
data.changeRequestEnvironments = changeRequestEnvironments; | ||
} else { | ||
data.changeRequestEnvironments = []; | ||
} |
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.
More verbose version looks more readable
This PR removes the workaround introduced in #6931. After https://github.com/ivarconr/unleash-enterprise/pull/1268 has been merged, this should be safe to apply.
Notably, this PR:
The last point is less important than it might seem because both the env validation and the current implementation of the callback is essentially a no-op when there are no envs. However, that's hard to enforce. If we just exit out early, then at least we know nothing happens.
Optionally, we could do something like this instead, but I'm not sure it's better or worse. Happy to take input.