mirror of
https://github.com/lobehub/lobe-chat.git
synced 2025-12-20 01:12:52 +08:00
🩹 fix: ignore abort signal errors in TRPC client (#9809)
- Add abort error detection in lambda client error handling link - Prevent showing notifications for aborted requests (e.g., rapid settings updates) - Check for various abort error patterns: 'aborted', 'AbortError', 'signal is aborted without reason' Fixes #9401 Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Arvin Xu <arvinxx@users.noreply.github.com>
This commit is contained in:
@@ -21,10 +21,16 @@ const errorHandlingLink: TRPCLink<LambdaRouter> = () => {
|
||||
next(op).subscribe({
|
||||
complete: () => observer.complete(),
|
||||
error: async (err) => {
|
||||
// Check if this is an abort error and should be ignored
|
||||
const isAbortError = err.message.includes('aborted') || err.name === 'AbortError' ||
|
||||
err.cause?.name === 'AbortError' ||
|
||||
err.message.includes('signal is aborted without reason');
|
||||
|
||||
const showError = (op.context?.showNotification as boolean) ?? true;
|
||||
const status = err.data?.httpStatus as number;
|
||||
|
||||
if (showError) {
|
||||
// Don't show notifications for abort errors
|
||||
if (showError && !isAbortError) {
|
||||
const { loginRequired } = await import('@/components/Error/loginRequiredNotification');
|
||||
const { fetchErrorNotification } = await import(
|
||||
'@/components/Error/fetchErrorNotification'
|
||||
|
||||
Reference in New Issue
Block a user