Skip to content

Commit 6c703e1

Browse files
only21milcodex
andauthored
fix(web): allow Antigravity installation while status loads (#23746)
Co-authored-by: GPT-6.1 Sol <[email protected]>
1 parent 3e7277e commit 6c703e1

2 files changed

Lines changed: 53 additions & 16 deletions

File tree

‎apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,41 @@ function resetSetup() {
181181
}
182182

183183
describe("Antigravity setup", () => {
184+
it("can start installation before the first install snapshot arrives", async () => {
185+
resetSetup();
186+
setup.auth = authState({ phase: "idle", flowId: null, authorizationUrl: null });
187+
const idleInstallation = setup.installation!;
188+
setup.installation = null;
189+
let resolveStart!: () => void;
190+
const command = new Promise<{ _tag: "Success"; value: undefined }>((resolve) => {
191+
resolveStart = () => resolve({ _tag: "Success", value: undefined });
192+
});
193+
setup.startInstall.mockReturnValueOnce(command);
194+
await using screen = await renderSetup({ provider: { ...provider, installed: false } });
195+
196+
await screen.click("Install Antigravity");
197+
await expect
198+
.element(screen.getByRole("status").filter({ hasText: "Starting installation." }))
199+
.toBeVisible();
200+
201+
setup.installation = {
202+
...idleInstallation,
203+
operationId: "install-1",
204+
phase: "downloading",
205+
downloadedBytes: 1_000_000,
206+
totalBytes: 2_000_000,
207+
};
208+
await publish();
209+
await expect
210+
.element(screen.getByRole("button", { name: "Cancel installation" }))
211+
.toBeDisabled();
212+
await act(async () => resolveStart());
213+
await expect.element(screen.getByRole("button", { name: "Cancel installation" })).toBeEnabled();
214+
await expect
215+
.element(screen.getByRole("status").filter({ hasText: "Downloading 1.0 MB of 2.0 MB." }))
216+
.toBeVisible();
217+
});
218+
184219
it("waits for verified auth after submitting a callback to the selected environment", async () => {
185220
resetSetup();
186221
const callbackUrl = "http://127.0.0.1:5555/?state=test-only&code=test-only";

‎apps/web/src/components/settings/ProviderSetupSection.tsx‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,23 @@ function ProviderSetupActions({
132132
const queryError = authQuery.error ?? installQuery.error;
133133
const actionsDisabled = pendingLabel !== null || queryError !== null;
134134
const installationStatusMessage =
135-
installation?.phase === "downloading"
136-
? `Downloading ${(installation.downloadedBytes / 1_000_000).toFixed(1)} MB${installation.totalBytes === null ? "" : ` of ${(installation.totalBytes / 1_000_000).toFixed(1)} MB`}.`
137-
: installation?.phase === "extracting"
138-
? "Extracting Antigravity."
139-
: installation?.phase === "verifying"
140-
? "Checking the downloaded runtime."
141-
: installed
142-
? "Installed."
143-
: usesCustomBinary
144-
? enabled
145-
? "The configured Antigravity runtime is unavailable."
146-
: "The configured Antigravity runtime has not been checked."
147-
: installation?.totalBytes
148-
? `${Math.ceil(installation.totalBytes / 1_000_000)} MB download.`
149-
: "Not installed.";
135+
installation === null
136+
? "Checking the Antigravity runtime."
137+
: installation?.phase === "downloading"
138+
? `Downloading ${(installation.downloadedBytes / 1_000_000).toFixed(1)} MB${installation.totalBytes === null ? "" : ` of ${(installation.totalBytes / 1_000_000).toFixed(1)} MB`}.`
139+
: installation?.phase === "extracting"
140+
? "Extracting Antigravity."
141+
: installation?.phase === "verifying"
142+
? "Checking the downloaded runtime."
143+
: installed
144+
? "Installed."
145+
: usesCustomBinary
146+
? enabled
147+
? "The configured Antigravity runtime is unavailable."
148+
: "The configured Antigravity runtime has not been checked."
149+
: installation?.totalBytes
150+
? `${Math.ceil(installation.totalBytes / 1_000_000)} MB download.`
151+
: "Not installed.";
150152

151153
async function runCommand<A, E>(
152154
label: string,
@@ -257,7 +259,7 @@ function ProviderSetupActions({
257259
<Button
258260
size="sm"
259261
variant="outline"
260-
disabled={actionsDisabled || installation === null || authActive}
262+
disabled={actionsDisabled || authActive}
261263
onClick={() =>
262264
void runCommand("Starting installation", () => startInstall(target))
263265
}

0 commit comments

Comments
 (0)