TypeScript
fix(client): slow servers finish loading the thread list instead of loading it twice (#13683)
Theo Browneb2577d6eface
diff --git a/packages/client-runtime/src/state/session.ts b/packages/client-runtime/src/state/session.tsindex 5787bd0e60b..15848d95d96 100644--- a/packages/client-runtime/src/state/session.ts+++ b/packages/client-runtime/src/state/session.ts@@ -30,8 +30,8 @@ function initialConfigOption<E>();}-// Bounded like the snapshot fetches: a wedged environment must not pin the-// permissions check (and with it the settings UI) in a loading state for long.+// Bounded so a wedged environment cannot pin the permissions check (and with it+// the settings UI) in a loading state for long.const DEFAULT_SESSION_STATE_TIMEOUT_MS = 6_000;/**diff --git a/packages/client-runtime/src/state/shellSnapshotHttp.ts b/packages/client-runtime/src/state/shellSnapshotHttp.tsindex 84ab1a3f1d4..fe5a3d5fcec 100644--- a/packages/client-runtime/src/state/shellSnapshotHttp.ts+++ b/packages/client-runtime/src/state/shellSnapshotHttp.ts@@ -12,9 +12,13 @@ import { environmentEndpointUrl } from "../environment/endpoint.ts";import { ManagedRelayDpopSigner } from "../relay/managedRelay.ts";import { executeAuthenticatedEnvironmentHttpRequest } from "./environmentHttpAuth.ts";-// Bounded so a pathologically slow endpoint cannot block the (cheaper) socket-// fallback for long. The cached shell renders while this runs.-const DEFAULT_SHELL_SNAPSHOT_TIMEOUT_MS = 6_000;+// Long enough for a slow but alive server to finish. On timeout the socket asks+// the same server for the same full snapshot, so a short deadline only throws+// the first build away. The socket fallback is for setups where /api fails but+// /ws works, such as a proxy that blocks /api. A dead server is caught by the+// socket ping, which drops the session and interrupts this load. The cached+// shell renders while this runs.+const DEFAULT_SHELL_SNAPSHOT_TIMEOUT_MS = 20_000;/*** Load the environment shell snapshot (projects + thread shells) over HTTPdiff --git a/packages/client-runtime/src/state/threadSnapshotHttp.ts b/packages/client-runtime/src/state/threadSnapshotHttp.tsindex 9582ad30567..da1156cc83e 100644--- a/packages/client-runtime/src/state/threadSnapshotHttp.ts+++ b/packages/client-runtime/src/state/threadSnapshotHttp.ts@@ -13,10 +13,13 @@ import { ManagedRelayDpopSigner } from "../relay/managedRelay.ts";import type { RemoteEnvironmentRequestError } from "../rpc/http.ts";import { executeAuthenticatedEnvironmentHttpRequest } from "./environmentHttpAuth.ts";-// Bounded so a pathologically slow endpoint cannot block the (cheaper) socket-// fallback for long. The cached thread renders while this runs, so the wait only-// delays the transition to live data on the first open, not the initial paint.-const DEFAULT_THREAD_SNAPSHOT_TIMEOUT_MS = 6_000;+// Long enough for a slow but alive server to finish. On a cold open a timeout+// makes the socket ask the same server for the same snapshot again, and older+// turn pages have no fallback, so a short deadline only drops work. The socket+// fallback is for setups where /api fails but /ws works, such as a proxy that+// blocks /api. A dead server drops the socket session, which interrupts a+// cold-open load. Older turn pages wait for this deadline.+const DEFAULT_THREAD_SNAPSHOT_TIMEOUT_MS = 20_000;/*** Load a thread's detail snapshot over HTTP instead of embedding it in the