Skip to content

Commit cbf8db2

Browse files
committed
Only change endpoint if it's new
1 parent 71cadd4 commit cbf8db2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/contents/gitpod-dashboard.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ const automaticallyUpdateEndpoint = async () => {
2626

2727
const currentHost = window.location.host;
2828
if (currentHost !== new URL(DEFAULT_GITPOD_ENDPOINT).host) {
29-
console.log(`Gitpod extension: switching default endpoint to ${currentHost}.`);
30-
await storage.set(STORAGE_KEY_ADDRESS, parseEndpoint(currentHost));
29+
const currentlyStoredEndpoint = await storage.get<string>(STORAGE_KEY_ADDRESS);
30+
if (
31+
(currentlyStoredEndpoint && new URL(currentlyStoredEndpoint).host !== currentHost) ||
32+
!currentlyStoredEndpoint
33+
) {
34+
console.log(`Gitpod extension: switching default endpoint to ${currentHost}.`);
35+
await storage.set(STORAGE_KEY_ADDRESS, parseEndpoint(currentHost));
36+
}
3137
}
3238
};
3339

0 commit comments

Comments
 (0)