这一大坨玩意我不想写说明了

This commit is contained in:
CrescentLeaf
2025-12-14 16:34:45 +08:00
parent 6a1ae692f9
commit 56f651f084
22 changed files with 653 additions and 41 deletions

View File

@@ -0,0 +1,22 @@
import { Chat } from "lingchair-client-protocol"
import { Await } from "react-router"
import getClient from "../../getClient"
import ChatFragment from "./ChatFragment"
import * as React from 'react'
import showSnackbar from "../../utils/showSnackbar"
import EffectOnly from "../EffectOnly"
export default function LazyChatFragment({ chatId, openedWithRouter }: { chatId: string, openedWithRouter: boolean }) {
return <React.Suspense fallback={<EffectOnly effect={() => {
const s = showSnackbar({
message: '请稍后',
})
return () => {
s.open = false
}
}} deps={[]} />}>
<Await
resolve={React.useMemo(() => Chat.getByIdOrThrow(getClient(), chatId), [chatId])}
children={(chatInfo: Chat) => <ChatFragment chatInfo={chatInfo} openedWithRouter={openedWithRouter} />} />
</React.Suspense>
}