From 4a269e6b0e88944f987b22e3f23fe94cc6908720 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Mon, 23 Mar 2026 10:46:25 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(y-provider)=20fix=20loop=20when=20?= =?UTF-8?q?no=20cookies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We observed a huge amount of logs sometimes in the y-provider server logs, all related to the same error: "No cookies". When this happens, the client keeps trying to reconnect, and the server keeps logging the error, creating a loop. We stop the loop by checking if the error is a "No cookies" error, and if so, we don't try to reconnect. --- CHANGELOG.md | 1 + .../docs/doc-management/stores/useProviderStore.tsx | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f856765..100b791b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to - 🐛(backend) allow using search endpoint without refresh token enabled #2097 - 🐛(frontend) fix close panel when click on subdoc #2094 - 🐛(frontend) fix leftpanel button in doc version #9238 +- 🐛(y-provider) fix loop when no cookies #2101 ## [v4.8.2] - 2026-03-19 diff --git a/src/frontend/apps/impress/src/features/docs/doc-management/stores/useProviderStore.tsx b/src/frontend/apps/impress/src/features/docs/doc-management/stores/useProviderStore.tsx index f1c8d511..69616cfe 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-management/stores/useProviderStore.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-management/stores/useProviderStore.tsx @@ -48,6 +48,18 @@ export const useProviderStore = create((set, get) => ({ onDisconnect(data) { // Attempt to reconnect if the disconnection was clean (initiated by the client or server) if ((data.event as ExtendedCloseEvent).wasClean) { + if (data.event.reason === 'No cookies' && data.event.code === 4001) { + console.error( + 'Disconnection due to missing cookies. Not attempting to reconnect.', + ); + void provider.disconnect(); + set({ + isReady: true, + isConnected: false, + }); + return; + } + void provider.connect(); } },