Prevent WebSocket provider remount by defaulting to V1 (#11458)

This commit is contained in:
sp.wack 2025-10-21 21:11:15 +04:00 committed by GitHub
parent 9d19292619
commit 9520da668c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -154,7 +154,7 @@ function AppContent() {
t,
]);
const isV1Conversation = conversation?.conversation_version === "V1";
const isV0Conversation = conversation?.conversation_version === "V0";
const content = (
<ConversationSubscriptionsProvider>
@ -174,15 +174,11 @@ function AppContent() {
</ConversationSubscriptionsProvider>
);
// Wait for conversation data to load before rendering WebSocket provider
// This prevents the provider from unmounting/remounting when version changes from 0 to 1
if (!conversation) {
return content;
}
// Render WebSocket provider immediately to avoid mount/remount cycles
// The providers internally handle waiting for conversation data to be ready
return (
<WebSocketProviderWrapper
version={isV1Conversation ? 1 : 0}
version={isV0Conversation ? 0 : 1}
conversationId={conversationId}
>
{content}