Compare commits
2 Commits
263a02e0c7
...
326d62a8bd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
326d62a8bd | ||
|
|
25e5650441 |
@@ -73,7 +73,7 @@ export default class MduiPatchedTextAreaElement extends HTMLElement {
|
||||
shadow.appendChild(this.inputContainerDiv)
|
||||
}
|
||||
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
|
||||
console.log(this.inputDiv, name, oldValue, newValue)
|
||||
// console.log(this.inputDiv, name, oldValue, newValue)
|
||||
switch (name) {
|
||||
case 'value': {
|
||||
this.value = newValue || ''
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
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 EffectOnly from "../EffectOnly"
|
||||
import useAsyncEffect from "../../utils/useAsyncEffect"
|
||||
|
||||
export default function LazyChatFragment({ chatId, openedInDialog }: { chatId: string, openedInDialog: boolean }) {
|
||||
return <React.Suspense fallback={<EffectOnly effect={() => {}} deps={[]} />}>
|
||||
<Await
|
||||
resolve={React.useMemo(() => Chat.getByIdOrThrow(getClient(), chatId), [chatId])}
|
||||
children={(chatInfo: Chat) => <ChatFragment chatInfo={chatInfo} openedInDialog={openedInDialog} />} />
|
||||
const [child, setChild] = React.useState<React.ReactNode>()
|
||||
const chatInfoPromise = React.useMemo(() => Chat.getByIdOrThrow(getClient(), chatId), [chatId])
|
||||
|
||||
useAsyncEffect(async () => {
|
||||
setChild(<ChatFragment chatInfo={await chatInfoPromise} openedInDialog={openedInDialog} />)
|
||||
}, [chatId])
|
||||
|
||||
return <React.Suspense fallback={null}>
|
||||
{child}
|
||||
</React.Suspense>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user