Skip to content
TypeScript

fix(web): avoid duplicate Antigravity install status (#9419)

Rakshith Bhat2120fbc18573
diff --git a/apps/web/src/components/settings/ProviderSetupSection.test.tsx b/apps/web/src/components/settings/ProviderSetupSection.test.tsx
index aea1238e423..7e4c2695821 100644
--- a/apps/web/src/components/settings/ProviderSetupSection.test.tsx
+++ b/apps/web/src/components/settings/ProviderSetupSection.test.tsx
@@ -1,4 +1,4 @@
-import type { FunctionComponent, ReactElement } from "react";
+import { isValidElement, type FunctionComponent, type ReactElement } from "react";
import {
EnvironmentId,
ProviderDriverKind,
@@ -142,6 +142,23 @@ function button(view: unknown, label: string) {
);
}
+function countElements(
+ node: unknown,
+ predicate: (element: ReactElement<Record<string, unknown>>) => boolean,
+): number {
+ if (Array.isArray(node)) {
+ return node.reduce((total, child) => total + countElements(child, predicate), 0);
+ }
+ if (!isValidElement<Record<string, unknown>>(node)) return 0;
+ return (
+ Number(predicate(node)) +
+ Object.values(node.props).reduce<number>(
+ (total, value) => total + countElements(value, predicate),
+ 0,
+ )
+ );
+}
+
function click(view: unknown, label: string) {
const target = button(view, label);
if (!target) throw new Error(`Missing button: ${label}`);
@@ -285,6 +302,23 @@ describe("Antigravity setup", () => {
await flushPromises();
});
+ it("shows a repeated runtime status message only once", () => {
+ setup.installation = {
+ ...setup.installation!,
+ operationId: "install-1",
+ phase: "verifying",
+ message: "Checking the downloaded runtime.",
+ };
+
+ const view = renderSetup();
+ expect(
+ countElements(
+ view,
+ (element) => element.props.children === "Checking the downloaded runtime.",
+ ),
+ ).toBe(1);
+ });
+
it("removes an owned damaged runtime only after confirmation", async () => {
setup.auth = authState({ phase: "idle", flowId: null, authorizationUrl: null });
setup.installation = {
diff --git a/apps/web/src/components/settings/ProviderSetupSection.tsx b/apps/web/src/components/settings/ProviderSetupSection.tsx
index bbc70076248..49ad14cddd9 100644
--- a/apps/web/src/components/settings/ProviderSetupSection.tsx
+++ b/apps/web/src/components/settings/ProviderSetupSection.tsx
@@ -169,6 +169,20 @@ function ProviderSetupActions({
const authorizationUrl = auth?.phase === "waiting" ? auth.authorizationUrl : null;
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
+ ? "Antigravity is installed."
+ : usesCustomBinary
+ ? enabled
+ ? "The configured Antigravity runtime is unavailable."
+ : "The configured Antigravity runtime has not been checked."
+ : "Install the official Antigravity runtime before signing in.";
async function runCommand<A, E>(
label: string,
@@ -252,19 +266,7 @@ function ProviderSetupActions({
<div className="grid gap-2">
<p className="font-medium">Runtime</p>
<p role="status" className="text-muted-foreground">
- {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
- ? "Antigravity is installed."
- : usesCustomBinary
- ? enabled
- ? "The configured Antigravity runtime is unavailable."
- : "The configured Antigravity runtime has not been checked."
- : "Install the official Antigravity runtime before signing in."}
+ {installationStatusMessage}
</p>
{installation?.phase === "downloading" &&
installation.totalBytes !== null &&
@@ -276,7 +278,7 @@ function ProviderSetupActions({
max={installation.totalBytes}
/>
) : null}
- {installation?.message ? (
+ {installation?.message && installation.message !== installationStatusMessage ? (
<p className="text-muted-foreground [overflow-wrap:anywhere]">{installation.message}</p>
) : null}
{usesCustomBinary ? (