Skip to content

Commit 7952acc

Browse files
committed
chore: show compatibility headers when shift clicking version
1 parent a8bec90 commit 7952acc

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

frontend/src/ts/ape/adapters/ts-rest-adapter.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import * as Notifications from "../../elements/notifications";
1515

1616
let bannerShownThisSession = false;
1717

18+
export let lastSeenServerCompatibility: number | undefined;
19+
1820
function timeoutSignal(ms: number): AbortSignal {
1921
const ctrl = new AbortController();
2022
setTimeout(() => ctrl.abort(new Error("request timed out")), ms);
@@ -52,6 +54,11 @@ function buildApi(timeout: number): (args: ApiFetcherArgs) => Promise<{
5254
const compatibilityCheckHeader = response.headers.get(
5355
COMPATIBILITY_CHECK_HEADER
5456
);
57+
58+
if (compatibilityCheckHeader !== null) {
59+
lastSeenServerCompatibility = parseInt(compatibilityCheckHeader);
60+
}
61+
5562
if (compatibilityCheckHeader !== null && !bannerShownThisSession) {
5663
const backendCheck = parseInt(compatibilityCheckHeader);
5764
if (backendCheck !== COMPATIBILITY_CHECK) {

frontend/src/ts/event-handlers/footer.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import * as SupportPopup from "../modals/support";
77
import * as ContactModal from "../modals/contact";
88
import * as VersionHistoryModal from "../modals/version-history";
99
import { envConfig } from "../constants/env-config";
10+
import { COMPATIBILITY_CHECK } from "@monkeytype/contracts";
11+
import { lastSeenServerCompatibility } from "../ape/adapters/ts-rest-adapter";
1012

1113
document
1214
.querySelector("footer #commandLineMobileButton")
@@ -28,7 +30,17 @@ document
2830
?.addEventListener("click", (e) => {
2931
const event = e as MouseEvent;
3032
if (event.shiftKey) {
31-
alert(envConfig.clientVersion);
33+
alert(
34+
JSON.stringify(
35+
{
36+
clientVersion: envConfig.clientVersion,
37+
clientCompatibility: COMPATIBILITY_CHECK,
38+
lastSeenServerCompatibility,
39+
},
40+
null,
41+
2
42+
)
43+
);
3244
} else {
3345
VersionHistoryModal.show();
3446
}

0 commit comments

Comments
 (0)