fix(ui): remove duplicate getChatById fetch in share chat modal

This commit is contained in:
silentoplayz 2026-06-11 14:16:37 -04:00
parent b1d40f3409
commit 1bc6b13346

View file

@ -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>