From 2150213a25371eb4d359574a78b9df82ac3e1dbb Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Tue, 1 Aug 2023 18:20:00 +0800 Subject: [PATCH] chore: updates --- src/components/ErrorCatcher.tsx | 7 +++++-- src/hooks/useDeleteMessage.ts | 2 +- src/hooks/useStreaming/index.ts | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/ErrorCatcher.tsx b/src/components/ErrorCatcher.tsx index 65f6e936..74232c71 100644 --- a/src/components/ErrorCatcher.tsx +++ b/src/components/ErrorCatcher.tsx @@ -1,5 +1,6 @@ -import React, { ReactNode } from "react"; +import { ReactNode } from "react"; import { ErrorBoundary } from "react-error-boundary"; +import StyledButton from "./styled/Button"; type FallbackProps = { error: Error; @@ -10,7 +11,9 @@ function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {

Something went wrong:

{error.message}
- + + Try again +
); } diff --git a/src/hooks/useDeleteMessage.ts b/src/hooks/useDeleteMessage.ts index 16e71363..34e66e8d 100644 --- a/src/hooks/useDeleteMessage.ts +++ b/src/hooks/useDeleteMessage.ts @@ -22,7 +22,7 @@ export default function useDeleteMessage() { if (!mids) return; const _arr = Array.isArray(mids) ? mids : [mids]; setDeleting(true); - if (compareVersion(serverVersion, "0.3.11") > -1) { + if (compareVersion(serverVersion, "0.3.10") > -1) { // batch delete await batchRemove(_arr); } else { diff --git a/src/hooks/useStreaming/index.ts b/src/hooks/useStreaming/index.ts index f784313a..20d0bf37 100644 --- a/src/hooks/useStreaming/index.ts +++ b/src/hooks/useStreaming/index.ts @@ -108,7 +108,6 @@ export default function useStreaming() { } else { _token = resp.data.token; } - // return; } // 开始初始化 const params: { @@ -138,6 +137,7 @@ export default function useStreaming() { // 断网了 if (!navigator.onLine) { stopStreaming(); + return; } const { readyState } = err.target as EventSource; console.info("sse error", readyState, err);