Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fixing chat window api recall fix on changing browser tab or window (#23301)

znn7831d44099d9
diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsx
index 382ded32017..e88d28879b0 100644
--- a/web/app/components/base/chat/chat-with-history/hooks.tsx
+++ b/web/app/components/base/chat/chat-with-history/hooks.tsx
@@ -159,9 +159,21 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
return currentConversationId
}, [currentConversationId, newConversationId])
- const { data: appPinnedConversationData, mutate: mutateAppPinnedConversationData } = useSWR(['appConversationData', isInstalledApp, appId, true], () => fetchConversations(isInstalledApp, appId, undefined, true, 100))
- const { data: appConversationData, isLoading: appConversationDataLoading, mutate: mutateAppConversationData } = useSWR(['appConversationData', isInstalledApp, appId, false], () => fetchConversations(isInstalledApp, appId, undefined, false, 100))
- const { data: appChatListData, isLoading: appChatListDataLoading } = useSWR(chatShouldReloadKey ? ['appChatList', chatShouldReloadKey, isInstalledApp, appId] : null, () => fetchChatList(chatShouldReloadKey, isInstalledApp, appId))
+ const { data: appPinnedConversationData, mutate: mutateAppPinnedConversationData } = useSWR(
+ appId ? ['appConversationData', isInstalledApp, appId, true] : null,
+ () => fetchConversations(isInstalledApp, appId, undefined, true, 100),
+ { revalidateOnFocus: false, revalidateOnReconnect: false },
+ )
+ const { data: appConversationData, isLoading: appConversationDataLoading, mutate: mutateAppConversationData } = useSWR(
+ appId ? ['appConversationData', isInstalledApp, appId, false] : null,
+ () => fetchConversations(isInstalledApp, appId, undefined, false, 100),
+ { revalidateOnFocus: false, revalidateOnReconnect: false },
+ )
+ const { data: appChatListData, isLoading: appChatListDataLoading } = useSWR(
+ chatShouldReloadKey ? ['appChatList', chatShouldReloadKey, isInstalledApp, appId] : null,
+ () => fetchChatList(chatShouldReloadKey, isInstalledApp, appId),
+ { revalidateOnFocus: false, revalidateOnReconnect: false },
+ )
const [clearChatList, setClearChatList] = useState(false)
const [isResponding, setIsResponding] = useState(false)