diff --git a/src/common/component/MarkdownEditor/index.tsx b/src/common/component/MarkdownEditor/index.tsx index 424ac225..0f14e823 100644 --- a/src/common/component/MarkdownEditor/index.tsx +++ b/src/common/component/MarkdownEditor/index.tsx @@ -82,3 +82,4 @@ const MarkdownEditor: FC = ({ ); }; export default MarkdownEditor; +// prosemirror-mode version error https://github.com/ueberdosis/tiptap/issues/577 diff --git a/src/common/component/MixedInput/index.tsx b/src/common/component/MixedInput/index.tsx index 42254473..edbd21fe 100644 --- a/src/common/component/MixedInput/index.tsx +++ b/src/common/component/MixedInput/index.tsx @@ -1,4 +1,4 @@ -import { useRef, useEffect, useState, useCallback, ClipboardEvent } from "react"; +import { useRef, useEffect, useState, useCallback, ClipboardEvent, FC } from "react"; import { useKey } from "rooks"; import { Editor, Transforms } from "slate"; import { @@ -30,10 +30,19 @@ let components = createPlateUI({ // customize your components by plugin key }); const initials = [{ type: ELEMENT_PARAGRAPH, children: [{ text: "" }] }]; -const Plugins = ({ +type ctx = "channel" | "user"; +type Props = { + updateDraft: (draft: any) => void | null; + initialValue?: any; + id: `${ctx}_${number}`; + placeholder: string; + sendMessages: any; + members: number[]; +}; +const Plugins: FC = ({ updateDraft = null, initialValue = initials, - id = "", + id, placeholder = "Write some markdown...", sendMessages, members = [] diff --git a/src/common/hook/useStreaming/index.ts b/src/common/hook/useStreaming/index.ts index 1cdf6308..71bc41d7 100644 --- a/src/common/hook/useStreaming/index.ts +++ b/src/common/hook/useStreaming/index.ts @@ -62,7 +62,6 @@ export default function useStreaming() { } = store.getState(); let api_token = token; const tokenAlmostExpire = dayjs().isAfter(new Date(expireTime - 20 * 1000)); - console.log("check token expire time", tokenAlmostExpire); if (tokenAlmostExpire) { const resp = await renewToken({ token, @@ -285,7 +284,7 @@ export default function useStreaming() { }, onerror(err) { initializing = false; - if (err instanceof FatalError) { + if (err instanceof FatalError || err.toString().indexOf("network error") > -1) { console.log("sse debug: error fatal", err); throw err; // rethrow to stop the operation } else { diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 40a172cf..8b69e0ac 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -26,7 +26,7 @@ import HomePage from "./home"; import ChatPage from "./chat"; import Loading from "../common/component/Loading"; import store, { useAppSelector } from "../app/store"; - +let toastId: string; const PageRoutes = () => { const { ui: { online }, @@ -37,10 +37,9 @@ const PageRoutes = () => { // 掉线检测 useEffect(() => { - let toastId = "0"; if (!online) { - toast.error("Network Offline!", { duration: Infinity }); - } else { + toastId = toast.error("Network Offline!", { duration: Infinity }); + } else if (toastId) { toast.dismiss(toastId); } }, [online]); diff --git a/src/routes/setting/config/Agora.tsx b/src/routes/setting/config/Agora.tsx index 683847fd..80bd1462 100644 --- a/src/routes/setting/config/Agora.tsx +++ b/src/routes/setting/config/Agora.tsx @@ -23,7 +23,7 @@ export default function ConfigAgora() { return { ...prev, [type]: newValue }; }); }; - // if (!values) return null; + if (!values) return null; const { url, project_id,