chore: updates

This commit is contained in:
Tristan Yang
2023-08-01 18:20:00 +08:00
parent b9b62bc3be
commit 2150213a25
3 changed files with 7 additions and 4 deletions
+5 -2
View File
@@ -1,5 +1,6 @@
import React, { ReactNode } from "react"; import { ReactNode } from "react";
import { ErrorBoundary } from "react-error-boundary"; import { ErrorBoundary } from "react-error-boundary";
import StyledButton from "./styled/Button";
type FallbackProps = { type FallbackProps = {
error: Error; error: Error;
@@ -10,7 +11,9 @@ function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
<div role="alert" className="text-lg text-red-600"> <div role="alert" className="text-lg text-red-600">
<p>Something went wrong:</p> <p>Something went wrong:</p>
<pre>{error.message}</pre> <pre>{error.message}</pre>
<button onClick={resetErrorBoundary}>Try again</button> <StyledButton className="mini" onClick={resetErrorBoundary}>
Try again
</StyledButton>
</div> </div>
); );
} }
+1 -1
View File
@@ -22,7 +22,7 @@ export default function useDeleteMessage() {
if (!mids) return; if (!mids) return;
const _arr = Array.isArray(mids) ? mids : [mids]; const _arr = Array.isArray(mids) ? mids : [mids];
setDeleting(true); setDeleting(true);
if (compareVersion(serverVersion, "0.3.11") > -1) { if (compareVersion(serverVersion, "0.3.10") > -1) {
// batch delete // batch delete
await batchRemove(_arr); await batchRemove(_arr);
} else { } else {
+1 -1
View File
@@ -108,7 +108,6 @@ export default function useStreaming() {
} else { } else {
_token = resp.data.token; _token = resp.data.token;
} }
// return;
} }
// 开始初始化 // 开始初始化
const params: { const params: {
@@ -138,6 +137,7 @@ export default function useStreaming() {
// 断网了 // 断网了
if (!navigator.onLine) { if (!navigator.onLine) {
stopStreaming(); stopStreaming();
return;
} }
const { readyState } = err.target as EventSource; const { readyState } = err.target as EventSource;
console.info("sse error", readyState, err); console.info("sse error", readyState, err);