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)
|
shadow.appendChild(this.inputContainerDiv)
|
||||||
}
|
}
|
||||||
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
|
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) {
|
switch (name) {
|
||||||
case 'value': {
|
case 'value': {
|
||||||
this.value = newValue || ''
|
this.value = newValue || ''
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
import { Chat } from "lingchair-client-protocol"
|
import { Chat } from "lingchair-client-protocol"
|
||||||
import { Await } from "react-router"
|
|
||||||
import getClient from "../../getClient"
|
import getClient from "../../getClient"
|
||||||
import ChatFragment from "./ChatFragment"
|
import ChatFragment from "./ChatFragment"
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import EffectOnly from "../EffectOnly"
|
import useAsyncEffect from "../../utils/useAsyncEffect"
|
||||||
|
|
||||||
export default function LazyChatFragment({ chatId, openedInDialog }: { chatId: string, openedInDialog: boolean }) {
|
export default function LazyChatFragment({ chatId, openedInDialog }: { chatId: string, openedInDialog: boolean }) {
|
||||||
return <React.Suspense fallback={<EffectOnly effect={() => {}} deps={[]} />}>
|
const [child, setChild] = React.useState<React.ReactNode>()
|
||||||
<Await
|
const chatInfoPromise = React.useMemo(() => Chat.getByIdOrThrow(getClient(), chatId), [chatId])
|
||||||
resolve={React.useMemo(() => Chat.getByIdOrThrow(getClient(), chatId), [chatId])}
|
|
||||||
children={(chatInfo: Chat) => <ChatFragment chatInfo={chatInfo} openedInDialog={openedInDialog} />} />
|
useAsyncEffect(async () => {
|
||||||
|
setChild(<ChatFragment chatInfo={await chatInfoPromise} openedInDialog={openedInDialog} />)
|
||||||
|
}, [chatId])
|
||||||
|
|
||||||
|
return <React.Suspense fallback={null}>
|
||||||
|
{child}
|
||||||
</React.Suspense>
|
</React.Suspense>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user