fix: Analyst ratings abort without reason on overview page
- trpcQuery/trpcMutate now throw 'Request timed out (8s)' instead of generic 'The operation was aborted.' so users know WHY the request failed - AnalystRatings adds cancelled guard (race condition fix) so stale promise results from symbol changes are ignored (matches OverviewPanel pattern) - Add Retry button on error state for timeout or other failures - useEffect cleanup returns cancelled flag setter
This commit is contained in:
@@ -396,6 +396,11 @@ async function trpcQuery<T>(procedure: string, input?: unknown): Promise<T> {
|
||||
signal: controller.signal,
|
||||
});
|
||||
return parse<T>(res);
|
||||
} catch (e) {
|
||||
if (e instanceof DOMException && e.name === "AbortError") {
|
||||
throw new Error(`Request timed out (${TRPC_TIMEOUT_MS / 1000}s)`);
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
@@ -413,6 +418,11 @@ async function trpcMutate<T>(procedure: string, input: unknown): Promise<T> {
|
||||
signal: controller.signal,
|
||||
});
|
||||
return parse<T>(res);
|
||||
} catch (e) {
|
||||
if (e instanceof DOMException && e.name === "AbortError") {
|
||||
throw new Error(`Request timed out (${TRPC_TIMEOUT_MS / 1000}s)`);
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user