// Main-process team summary batches have a 30s deadline; keep the renderer guard above it. export const TEAM_CHANGES_LOAD_TIMEOUT_MS = 35_000; export function withTeamChangesLoadTimeout( promise: Promise, timeoutMs = TEAM_CHANGES_LOAD_TIMEOUT_MS ): Promise { let timeoutId: ReturnType | null = null; const timeoutPromise = new Promise((_resolve, reject) => { timeoutId = setTimeout(() => { reject(new Error('Team changes request timed out. Refresh to try again.')); }, timeoutMs); }); return Promise.race([promise, timeoutPromise]).finally(() => { if (timeoutId !== null) { clearTimeout(timeoutId); } }); }