mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
fix: prevent loop when fetching shared chat id
This commit is contained in:
@@ -57,10 +57,23 @@
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$: if (show) {
|
||||
(async () => {
|
||||
if (chatId) {
|
||||
chat = await getChatById(localStorage.token, chatId);
|
||||
const _chat = await getChatById(localStorage.token, chatId);
|
||||
if (isDifferentChat(_chat)) {
|
||||
chat = _chat;
|
||||
}
|
||||
} else {
|
||||
chat = null;
|
||||
console.log(chat);
|
||||
@@ -137,6 +150,7 @@
|
||||
<button
|
||||
class=" self-center flex items-center gap-1 px-3.5 py-2 rounded-xl text-sm font-medium bg-emerald-600 hover:bg-emerald-500 text-white"
|
||||
type="button"
|
||||
id="copy-and-share-chat-button"
|
||||
on:click={async () => {
|
||||
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
>
|
||||
<button
|
||||
class="cursor-pointer p-1.5 flex dark:hover:bg-gray-700 rounded-full transition"
|
||||
id="chat-context-menu-button"
|
||||
>
|
||||
<div class=" m-auto self-center">
|
||||
<svg
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
{#if shareEnabled}
|
||||
<DropdownMenu.Item
|
||||
class="flex gap-2 items-center px-3 py-2 text-sm cursor-pointer dark:hover:bg-gray-850 rounded-md"
|
||||
id="chat-share-button"
|
||||
on:click={() => {
|
||||
shareHandler();
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user