修正错误的收藏对话读取
This commit is contained in:
@@ -17,12 +17,12 @@ export default function FavouriteChatsList({ ...props }: React.HTMLAttributes<HT
|
|||||||
setShowAddFavourtieChatDialog: context.setShowAddFavourtieChatDialog,
|
setShowAddFavourtieChatDialog: context.setShowAddFavourtieChatDialog,
|
||||||
state: context.state,
|
state: context.state,
|
||||||
functions_lazy: context.functions_lazy,
|
functions_lazy: context.functions_lazy,
|
||||||
|
setFavouriteChats: context.setFavouriteChats,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const searchRef = React.useRef<HTMLElement>(null)
|
const searchRef = React.useRef<HTMLElement>(null)
|
||||||
const [isMultiSelecting, setIsMultiSelecting] = React.useState(false)
|
const [isMultiSelecting, setIsMultiSelecting] = React.useState(false)
|
||||||
const [searchText, setSearchText] = React.useState('')
|
const [searchText, setSearchText] = React.useState('')
|
||||||
const [favouriteChatsList, setFavouriteChatsList] = React.useState<Chat[]>([])
|
|
||||||
const [checkedList, setCheckedList] = React.useState<{ [key: string]: boolean }>({})
|
const [checkedList, setCheckedList] = React.useState<{ [key: string]: boolean }>({})
|
||||||
|
|
||||||
const nav = useNavigate()
|
const nav = useNavigate()
|
||||||
@@ -35,7 +35,7 @@ export default function FavouriteChatsList({ ...props }: React.HTMLAttributes<HT
|
|||||||
async function updateFavouriteChats() {
|
async function updateFavouriteChats() {
|
||||||
try {
|
try {
|
||||||
const ls = await (await ClientCache.getMySelf())!.getMyFavouriteChatsOrThrow()
|
const ls = await (await ClientCache.getMySelf())!.getMyFavouriteChatsOrThrow()
|
||||||
setFavouriteChatsList(ls)
|
shared.setFavouriteChats(ls)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof CallbackError)
|
if (e instanceof CallbackError)
|
||||||
if (e.code != 401 && e.code != 400)
|
if (e.code != 401 && e.code != 400)
|
||||||
@@ -147,7 +147,7 @@ export default function FavouriteChatsList({ ...props }: React.HTMLAttributes<HT
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
favouriteChatsList.filter((chat) =>
|
shared.state.favouriteChats.filter((chat) =>
|
||||||
searchText == '' ||
|
searchText == '' ||
|
||||||
chat.getTitle().includes(searchText) ||
|
chat.getTitle().includes(searchText) ||
|
||||||
chat.getId().includes(searchText)
|
chat.getId().includes(searchText)
|
||||||
|
|||||||
Reference in New Issue
Block a user