Skip to content
TypeScript

fix(web): allow Antigravity installation while status loads (#23746)

Victor Vogel6c703e1c9494
diff --git a/apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx b/apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx
index 4fa22377d99..e9404773f73 100644
--- a/apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx
+++ b/apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx
@@ -181,6 +181,41 @@ function resetSetup() {
}
describe("Antigravity setup", () => {
+ it("can start installation before the first install snapshot arrives", async () => {
+ resetSetup();
+ setup.auth = authState({ phase: "idle", flowId: null, authorizationUrl: null });
+ const idleInstallation = setup.installation!;
+ setup.installation = null;
+ let resolveStart!: () => void;
+ const command = new Promise<{ _tag: "Success"; value: undefined }>((resolve) => {
+ resolveStart = () => resolve({ _tag: "Success", value: undefined });
+ });
+ setup.startInstall.mockReturnValueOnce(command);
+ await using screen = await renderSetup({ provider: { ...provider, installed: false } });
+
+ await screen.click("Install Antigravity");
+ await expect
+ .element(screen.getByRole("status").filter({ hasText: "Starting installation." }))
+ .toBeVisible();
+
+ setup.installation = {
+ ...idleInstallation,
+ operationId: "install-1",
+ phase: "downloading",
+ downloadedBytes: 1_000_000,
+ totalBytes: 2_000_000,
+ };
+ await publish();
+ await expect
+ .element(screen.getByRole("button", { name: "Cancel installation" }))
+ .toBeDisabled();
+ await act(async () => resolveStart());
+ await expect.element(screen.getByRole("button", { name: "Cancel installation" })).toBeEnabled();
+ await expect
+ .element(screen.getByRole("status").filter({ hasText: "Downloading 1.0 MB of 2.0 MB." }))
+ .toBeVisible();
+ });
+
it("waits for verified auth after submitting a callback to the selected environment", async () => {
resetSetup();
const callbackUrl = "http://127.0.0.1:5555/?state=test-only&code=test-only";
diff --git a/apps/web/src/components/settings/ProviderSetupSection.tsx b/apps/web/src/components/settings/ProviderSetupSection.tsx
index c3f05fc5846..03591b64ca2 100644
--- a/apps/web/src/components/settings/ProviderSetupSection.tsx
+++ b/apps/web/src/components/settings/ProviderSetupSection.tsx
@@ -132,21 +132,23 @@ function ProviderSetupActions({
const queryError = authQuery.error ?? installQuery.error;
const actionsDisabled = pendingLabel !== null || queryError !== null;
const installationStatusMessage =
- installation?.phase === "downloading"
- ? `Downloading ${(installation.downloadedBytes / 1_000_000).toFixed(1)} MB${installation.totalBytes === null ? "" : ` of ${(installation.totalBytes / 1_000_000).toFixed(1)} MB`}.`
- : installation?.phase === "extracting"
- ? "Extracting Antigravity."
- : installation?.phase === "verifying"
- ? "Checking the downloaded runtime."
- : installed
- ? "Installed."
- : usesCustomBinary
- ? enabled
- ? "The configured Antigravity runtime is unavailable."
- : "The configured Antigravity runtime has not been checked."
- : installation?.totalBytes
- ? `${Math.ceil(installation.totalBytes / 1_000_000)} MB download.`
- : "Not installed.";
+ installation === null
+ ? "Checking the Antigravity runtime."
+ : installation?.phase === "downloading"
+ ? `Downloading ${(installation.downloadedBytes / 1_000_000).toFixed(1)} MB${installation.totalBytes === null ? "" : ` of ${(installation.totalBytes / 1_000_000).toFixed(1)} MB`}.`
+ : installation?.phase === "extracting"
+ ? "Extracting Antigravity."
+ : installation?.phase === "verifying"
+ ? "Checking the downloaded runtime."
+ : installed
+ ? "Installed."
+ : usesCustomBinary
+ ? enabled
+ ? "The configured Antigravity runtime is unavailable."
+ : "The configured Antigravity runtime has not been checked."
+ : installation?.totalBytes
+ ? `${Math.ceil(installation.totalBytes / 1_000_000)} MB download.`
+ : "Not installed.";
async function runCommand<A, E>(
label: string,
@@ -257,7 +259,7 @@ function ProviderSetupActions({
<Button
size="sm"
variant="outline"
- disabled={actionsDisabled || installation === null || authActive}
+ disabled={actionsDisabled || authActive}
onClick={() =>
void runCommand("Starting installation", () => startInstall(target))
}