-
-
Notifications
You must be signed in to change notification settings - Fork 740
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
task: Add banner encouraging edge upgrade #6018
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
e24be66
to
847d570
Compare
Only triggers if there is any rows in client instances that have sdk_version: unleash-edge with version < 17.0.0 The function that checks this memoizes the check for 10 minutes at the time to avoid scanning the client instances table too often.
Don't approve yet, I'm fixing the possible SQL Injection first. |
<ConditionallyRender | ||
condition={displayUpgradeEdgeBanner} | ||
show={<Banner key={'upgradeEdge'} banner={upgradeEdgeBanner} />} | ||
/> |
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.
Similarly to #5239 (comment) - I would recommend we create a new EdgeUpgradeBanner
(or similar) component and add it directly to App.tsx
. I don't think it makes much sense to add it here, especially as it is not an internal banner.
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.
Agreed. Will fix
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.
Looks good just a small thing around handling SemVer I think it's a safety check that's not hurtful to add. But Granting the approval as I don't expect that to happen, but just being extra cautious could be a good thing here
const semver = new SemVer(sdkVersion); | ||
const instancesOfSdk = | ||
await this.clientInstanceStore.getBySdkName(sdkName); | ||
return instancesOfSdk.some((instance) => { | ||
if (instance.sdkVersion) { | ||
const [_sdkName, sdkVersion] = instance.sdkVersion.split(':'); | ||
const instanceUsedSemver = new SemVer(sdkVersion); | ||
return instanceUsedSemver < semver; | ||
} | ||
}); |
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.
I was just checking that SemVer can throw some exceptions: https://github.com/npm/node-semver/blob/main/classes/semver.js and we have a helper class that does the try catch: https://github.com/Unleash/unleash/blob/chore/update-features-created-by-user-id/src/lib/util/semver.ts maybe we should just try catch here
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.
Thanks. Good point. I'll have a look
@@ -79,6 +79,7 @@ export type UiFlags = { | |||
executiveDashboard?: boolean; | |||
changeRequestConflictHandling?: boolean; | |||
feedbackComments?: Variant; | |||
displayUpgradeEdgeBanner?: boolean; |
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.
Might be worth considering making this a Variant
flag instead. That way we can control not only whether the banner is shown, but also its contents through the flag.
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.
This is something we'd like to have in OSS deploys as well, and hopefully not for very long.
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.
So, I think having it as a normal flag is fine.
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.
LG, but like mentioned in https://github.com/Unleash/unleash/pull/6018/files#r1464683982, I don't think it belongs inside InternalBanners
.
It's no longer in InternalBanners. |
<> | ||
<ConditionallyRender | ||
condition={displayUpgradeEdgeBanner} | ||
show={<Banner key={'upgradeEdge'} banner={upgradeEdgeBanner} />} |
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.
No need for key here, since it's only 1 element.
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.
LGTM! Thanks for addressing my comment 🙌
Only triggers if there is any rows in client instances that have
The function that checks this memoizes the check for 10 minutes to avoid scanning the client instances table too often.