mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-04 02:33:43 +00:00
fix(ui): remove duplicate getChatById fetch in share chat modal
This commit is contained in:
parent
b1d40f3409
commit
1bc6b13346
1 changed files with 10 additions and 22 deletions
|
|
@ -83,30 +83,18 @@
|
|||
|
||||
export let show = false;
|
||||
|
||||
const isDifferentChat = (_chat) => {
|
||||
if (!chat) {
|
||||
return true;
|
||||
}
|
||||
if (!_chat) {
|
||||
return false;
|
||||
}
|
||||
return chat.id !== _chat.id || chat.share_id !== _chat.share_id;
|
||||
};
|
||||
let _loadedChatId = null;
|
||||
|
||||
$: if (show) {
|
||||
(async () => {
|
||||
if (chatId) {
|
||||
const _chat = await getChatById(localStorage.token, chatId);
|
||||
if (isDifferentChat(_chat)) {
|
||||
chat = _chat;
|
||||
}
|
||||
$: if (show && chatId) {
|
||||
if (chatId !== _loadedChatId) {
|
||||
_loadedChatId = chatId;
|
||||
(async () => {
|
||||
chat = await getChatById(localStorage.token, chatId);
|
||||
await loadAccessGrants();
|
||||
} else {
|
||||
chat = null;
|
||||
accessGrants = [];
|
||||
console.log(chat);
|
||||
}
|
||||
})();
|
||||
})();
|
||||
}
|
||||
} else if (!show) {
|
||||
_loadedChatId = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue