From bb311b750fc71895d7159d3f9cc19e2e021c2718 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 5 Nov 2024 17:45:53 +0530 Subject: [PATCH] fix: wrong token being passed in the read-only editor (#5954) * fix: wrong token * chore: update useMemo dependencies --- .../src/core/hooks/use-read-only-collaborative-editor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/core/hooks/use-read-only-collaborative-editor.ts b/packages/editor/src/core/hooks/use-read-only-collaborative-editor.ts index 9fa73c3ecb1..d4081922973 100644 --- a/packages/editor/src/core/hooks/use-read-only-collaborative-editor.ts +++ b/packages/editor/src/core/hooks/use-read-only-collaborative-editor.ts @@ -32,7 +32,7 @@ export const useReadOnlyCollaborativeEditor = (props: TReadOnlyCollaborativeEdit new HocuspocusProvider({ url: realtimeConfig.url, name: id, - token: user.id, + token: JSON.stringify(user), parameters: realtimeConfig.queryParams, onAuthenticationFailed: () => { serverHandler?.onServerError?.(); @@ -47,7 +47,7 @@ export const useReadOnlyCollaborativeEditor = (props: TReadOnlyCollaborativeEdit }, onSynced: () => setHasServerSynced(true), }), - [id, realtimeConfig, user.id] + [id, realtimeConfig, user] ); // destroy and disconnect connection on unmount useEffect(