@devries-cameron20 / t3code Mirror · read-only / commits / 5806afff67
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 08:15 UTC

fix(web): skip star prompt when the server check is unavailable (#28364)

Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com> Co-authored-by: Exotic <118054752+extoci@users.noreply.github.com>

t3-code-bot[bot] committed Nov 1, 2026 at 21:51 UTC 5806afff6766cf40edc72cc841f8dcf2513a4ec2
2 files changed +19 -4
apps/web/src/components/GitHubStarPrompt.test.ts
+15 -2
@@ -5,7 +5,7 @@ import type { toastManager } from "./ui/toast";
5
6 const { add, starred } = vi.hoisted(() => ({
7 add: vi.fn<typeof toastManager.add>(),
8 - starred: { value: false, duringCheck: () => {} },
8 + starred: { value: false, failed: false, duringCheck: () => {} },
9 }));
10 vi.mock("./ui/toast", () => ({ toastManager: { add, close: vi.fn() } }));
11 vi.mock("../rpc/atomRegistry", () => ({ appAtomRegistry: {} }));
@@ -13,7 +13,7 @@ vi.mock("../state/sourceControl", () => ({ sourceControlEnvironment: { checkStar
13 vi.mock("@t3tools/client-runtime/state/runtime", () => ({
14 runAtomCommand: async () => {
15 starred.duringCheck();
16 - return { _tag: "Success", value: starred.value };
16 + return starred.failed ? { _tag: "Failure" } : { _tag: "Success", value: starred.value };
17 },
18 }));
19
@@ -22,6 +22,7 @@ const environmentId = EnvironmentId.make("environment-1");
22 function setup({ sent = 0, writable = true, alreadyStarred = false } = {}) {
23 add.mockReset();
24 starred.value = alreadyStarred;
25 + starred.failed = false;
26 starred.duringCheck = () => {};
27 const store = new Map([["t3code:github-star-prompt:sent", String(sent)]]);
28 vi.stubGlobal("window", {
@@ -81,6 +82,18 @@ describe("recordPromptSent", () => {
82 vi.unstubAllGlobals();
83 });
84
85 + it("skips an unavailable server check without permanently dismissing", async () => {
86 + const store = setup({ sent: 5 });
87 + starred.failed = true;
88 + await (await startSession()).send();
89 + expect(add).not.toHaveBeenCalled();
90 + expect(store.has("t3code:github-star-prompt:dismissed")).toBe(false);
91 + starred.failed = false;
92 + await (await startSession()).send();
93 + expect(add).toHaveBeenCalledOnce();
94 + vi.unstubAllGlobals();
95 + });
96 +
97 it("never asks when another tab dismisses it during the star check", async () => {
98 const store = setup({ sent: 5 });
99 starred.duringCheck = () => store.set("t3code:github-star-prompt:dismissed", "true");
apps/web/src/components/GitHubStarPrompt.tsx
+4 -2
@@ -64,7 +64,7 @@ async function alreadyStarred(environmentId: EnvironmentId) {
64 },
65 { label: "check GitHub star", reportFailure: false, reportDefect: false },
66 );
67 - return result._tag === "Success" && result.value;
67 + return result._tag === "Success" ? result.value : undefined;
68 }
69
70 /**
@@ -83,7 +83,9 @@ export async function recordPromptSent(environmentId: EnvironmentId): Promise<vo
83 return;
84 }
85 shownThisSession = true;
86 - if (await alreadyStarred(environmentId)) return dismiss();
86 + const starred = await alreadyStarred(environmentId);
87 + if (starred === undefined) return;
88 + if (starred) return dismiss();
89 try {
90 // Another tab can dismiss while the check runs.
91 if (getLocalStorageItem(DISMISSED_KEY, Schema.Boolean)) return;