Skip to content

Commit

Permalink
feat(compass): show the autoupdate installed toast even when we downg…
Browse files Browse the repository at this point in the history
…rade COMPASS-8808 (#6612)

* Show the autoupdate installed toast even when we downgrade

* add data-testids to the toasts needed for testing
  • Loading branch information
lerouxb authored Jan 14, 2025
1 parent ae127af commit fc52bab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/compass/src/app/components/update-toasts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const RestartCompassToastContent = ({
<button
className={cx(buttonStyles, darkmode && buttonDarkStyles)}
onClick={onUpdateClicked}
data-testid="auto-update-restart-button"
>
Restart
</button>
Expand Down Expand Up @@ -83,6 +84,7 @@ export function onAutoupdateExternally({
Compass features.
</Body>
<Link
data-testid="auto-update-download-link"
as="a"
target="_blank"
href={'https://www.mongodb.com/try/download/compass'}
Expand Down Expand Up @@ -137,6 +139,7 @@ export function onAutoupdateInstalled({ newVersion }: { newVersion: string }) {
title: `Compass ${newVersion} installed successfully`,
description: (
<Link
data-testid="auto-update-release-notes-link"
as="a"
target="_blank"
href={`https://github.com/mongodb-js/compass/releases/tag/v${newVersion}`}
Expand Down
10 changes: 8 additions & 2 deletions packages/compass/src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,15 @@ const app = {
});
}

log.info(mongoLogId(1_001_000_338), 'Main Window', 'Recent version info', {
previousVersion: state.previousVersion,
highestInstalledVersion: state.highestInstalledVersion,
APP_VERSION,
});

if (
semver.gt(APP_VERSION, state.previousVersion) &&
state.previousVersion !== DEFAULT_APP_VERSION
state.previousVersion !== DEFAULT_APP_VERSION &&
APP_VERSION !== state.previousVersion
) {
// Wait a bit before showing the update toast.
setTimeout(() => {
Expand Down

0 comments on commit fc52bab

Please sign in to comment.